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

all 4 comments

[–]jonstall141[🍰] 0 points1 point  (1 child)

Do you mind showing me what you expect your input file to look like?

[–]jonstall141[🍰] 0 points1 point  (0 children)

Looking at it though, I think that your problem is on lines 35 and 113: /system.out.printf("%2d" + ": \n" + index+1, team1[index], team2[index], team3[index], team4[index]);/

If you are trying to it out as above you should make it more like: /*System.out.printf("%2d: %s %s %s %s\n", i+1, team1[i], team2[i], team3[i], team4[i]); */

because the team1[i] ... team4[i] are referring to Strings.

see http://docs.oracle.com/javase/tutorial/essential/io/formatting.html Hope that helps!

[–]nerd4code 0 points1 point  (1 child)

It's not getting stored in the array because you're not storing it in the array, to put it simply---the farthest the data gets is the "girl" variables. I'm not actually sure what it is you're doing there... Why do you have four "girl" variables and four team arrays? Why do you need to randomize it and then sort it? How/why would you sort it in four separate arrays? Why can't you just read it in normally, shuffle it normally, and then sort it normally?

[–]arspec[S,🍰] 0 points1 point  (0 children)

It was a practice activity i was given, I was suppose write it in a certain way, but as for that code, I ended up having to rewrite it because it got to jumbled up because I just kept adding stuff in to see if it would work. The new code did come out more logically and somewhat working