QUESTION

Attached you will find a program which reads information from a text file, creates an ArrayList of objects based on the read information and then rewrites the information back out to a second text file. (Yes, this is the example from the 2150 text file review module in Content).

This assignment has two parts:

Part 1:

1. Copy the two java files into a new Java project in your preferred IDE. Place the peopleFile.txt in the default location for your IDE (project directory NOT src for Eclipse)

2. Rename ReadPeopleFromFile.java to be WritePeopleToBinary.java

3. In the main method, instead of writing the information out to a text file- open a DataOutputStream object to create a binary file named "people.dat" and use the methods of DataOutputStream to write the same information originally written in binary format to "people.dat"

4. Attach WritePeopleToBinary.java to this assignment box

Part 2:

1. Create a new class named ReadBinaryFile with a main method.

2. Use DataInputStream library class to open and read the people.dat file created in part 1.

3. Use the information read to create an ArrayList of Person objects as the data is read in

4. After all the information is read in- print the ArrayList of Person objects.

5. Attach ReadBinaryFile.java to this assignment box.

Public Answer

UZPQDO The First Answerer