Question: Modify the code in Chapter 15s StudentList class in Figure 15.8 so that objects from that class can be written to a fi le. For

Modify the code in Chapter 15s StudentList class in Figure 15.8 so that objects from that class can be written to a fi le. For this exercise, you may simply ignore the dangerous method call in the removeStudent method. Using the WriteObject class in Figure 16.5 as a guide, encode a StudentListFileWriter class that writes three StudentList objects to a fi le called StudentLists , as follows: Construct the fi rst object with the same four names as those used in the StudentListDriver in Figure 15.9, and write it to the fi le. Construct the second object with those same four names plus the additional name Anna, and write it to the fi le. For the third object, use the remove method to remove Izumi from the second object, and write this modifi cation of the second object to the fi le so that it appears as a distinct third object in the fi le. Finally, using the ReadObject class in Figure 16.6 as a guide, encode a StudentListFileReader class that reads and displays all objects in the fi le. Run this StudentListFileReader to confi rm that the fi le holds three objects with different name lists.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!