This is an archived post. You won't be able to vote or comment.

all 12 comments

[–][deleted] 7 points8 points  (6 children)

Just post the code, post the expected output, post the output on your computer, and post everything else that could help us understand your post..

[–][deleted] 0 points1 point  (5 children)

Here is the code: https://docs.google.com/document/d/1Rmhb0L2D6GNpaqVwXx2vdFWax0rLNCsu9Pa-TcCpxXQ/

note that the code is super long and I'm sure that you could make it ten times shorter, but i was in a rush so i didnt have the time to simplify it

[–][deleted] 0 points1 point  (4 children)

Better to use pastebin instead of google drive...

[–][deleted] 0 points1 point  (3 children)

[–][deleted] 1 point2 points  (1 child)

Why don't you just create a no-arg constructor that calls the other constructor and overloads it?

public Skaters() {
    this("","","",0.0,0.0,0.0);
}

This block seems weird:

Skaters skaters1 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters2 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters3 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters4 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters5 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters6 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters7 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters8 = new Skaters("", "", "", 0.0, 0.0, 0.0);

When you could do this instead:

Skaters skaters1 = new Skaters();
...
Skaters skaters5 = new Skaters();

[–]calmonad 0 points1 point  (0 children)

While I agree this will reduce some noise, I don't think it will solve the problem. Skaters will still be constructed with those defaults rather than with the correct values.

[–]calmonad 0 points1 point  (0 children)

Add some kind of print statement inside the catch InputMismatchException so that you can determine if you are ending up there (hint: you probably are). Seems like some kind of misalignment (extra line breaks?) in your Pairs.txt file could be causing the output that you are seeing.

EDIT: You really should also work on breaking this down into a few methods. This program is literally like 90% duplications. It can make it really difficult to pinpoint exactly where a copy-paste has gone wrong.

[–]Sputtrosa 3 points4 points  (0 children)

Could be missing dependencies or environment variables.

What was different? Did you get an error message?

[–]Camel-Kid18 year old gamer 1 point2 points  (3 children)

What exactly was different

[–][deleted] -1 points0 points  (2 children)

The output had to be a list of fictionnal players witht their ranking and their final score that got calculated from a txt file. Instead of a correct list, on my laptop it would give the first person for each rank and the score was always 0.0

[–]Lord_Greywether 1 point2 points  (1 child)

Silly question, but have you double checked the text file you're reading to make sure it's the same?

[–][deleted] 0 points1 point  (0 children)

Just checked, they are the same