Create a text file that contains ten Person objects Solved

30.00 $ 15.00 $

Categories: ,


Create a text file that contains ten Person objects where each object is represented on a separate line with each attribute separated by a comma. Create a method that reads from the file, creates one Person object per line, and stores the object in an ArrayList object. Write the stored sorted objects by last name and display last name and first name to the console. For example, Salisbury, Robert.

The teaacher wants us to create this text file in the program itself by using file input commands within the program. The characateristics of the text file is from the previous person file we used before, which are these characterisitics: first name, last name, age, gender , social securtiy number. He wants the output to console to display last name first, then first name. For that to happen, he wants the arraylist to do a sort, so as to display the output correctly. Also, when we create the file, call it persons.text and save it to : c:/temp. file exceptions should also be in this program.