I need to take an array of three lines in a text file and sort them base on the first line in Java. I also need to manipulate this as well and then print to screen.
I have a test file that is formatted like this:
10
Michael
Jackson
12
Richard
Woolsey
I need to input this from a text file and then rearrange it based on the number associated with the name. At that point, I need to use a random number generator and assign a variable based on the random number to each name. Then I need to print to screen the variable I added and the name in a different format. Here is an example of the output:
12:
Woolsey, Richard
Variable assigned
10:
Jackson, Michael
Other variable assigned
I highly appreciate any help. I ask because I do not really know how to input the three lines as one variable and then manipulate later on in the program. Thanks, Cory