Problem

Modify the code in Chapter 15’s StudentList class in Figure so that objects from that clas...

Modify the code in Chapter 15’s

StudentList
class in Figure so that objects from that class can be written to a file. For this exercise, you may simply ignore the “dangerous method call” in the
removeStudent
method. Using the
WriteObject
class in Figure as a guide, encode a
StudentListFileWriter
class that writes three
StudentList
objects to a file called
StudentLists,
as follows: Construct the first object with the same four names as those used in the
StudentListDriver
in Figure, and write it to the file. Construct the second object with those same four names plus the additional name “Anna,” and write it to the file. For the third object, use the remove method to remove “Izumi” from the second object, and write this modification of the second object to the file so that it appears as a distinct third object in the file. Finally, using the
ReadObject
class in Figure as a guide, encode a
StudentListFileReader
class that reads and displays all objects in the file. Run this
StudentListFileReader
to confirm that the file holds three objects with different name lists.

Figure First draft of StudentList class, which maintains a list of students

Figure WriteObject program, which writes Serializable objects to a file

Figure Driver of StudentList class

Figure ReadObject class that reads all Serializable objects from a file

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 16
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT