Read a text file into arrays and output - Java Program ----------------------------------------------------------- XXXXXXXXXXI need to have a java program read an "input.txt" file (like below) and...

Read a text file into arrays and output - Java Program ------------------------------------------------------------------------------ I need to have a java program read an "input.txt" file (like below) and store the information in an respective arrays. This input.txt file will look like below and will be stored in the same directory as the java file. The top line of the text represents the number of people in the group for example. the lines below it each represent the respective persons preferences in regards to the other people in the group. I would then like the java program to output as a string each array and its elements. Example of "input.txt" that would be read 4 2 3 4 1 3 4 1 2 4 1 2 3 As you can see the top line says there are 4 people in this group and person #1 which is line #2 prefers to be in a group with persons 2, 3, and 4 respectively. So for Person #1 it would be an Array with 3 elements being 2, 3, and 4 in that order. The java program in this case would read the .txt file. create 4 arrays based on line #1 saying there are 4 people and then it would output as a string the 4 arrays and their respective elements in order, Example Output: Person #1 prefers 2, then 3, then 4 Person #2 prefers 1, then 3, then 4 . . . The java program should be able to work with text files that have different numbers of people, it should create # of arrays based on the number on line 1.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here