Question
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 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. Can you help me?
** I got a response from an expert, and everything was ok, except that the teacher wanted us to have the text file of the persons created in the program. The "persons.text" file is to be created by an arraylist in the program, and then it is to be read in the program. The last expert had it to where it was being read from , but the program itself did not create the text file. Here is what the last expert sent me. Can someone help me get it completed?
ok, i am editing this question.... everything was ok from before, however, the teacher wants us to manually put in objects in an array list, and then write it to a text file... i know it is something like add.xx("Mike","Sanford", "32","M","334343367");
it should add to the array, and then to write it to a text file ... the answers i got previously were correct , but it did not write to a text file the data for the persons - can you help me? the last time i got a response, it was the wrong program the expert sent... it was an Inventory class - probably a mistake - thank you for helping
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started