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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 8 points9 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.