Enhance the program you wrote for Programming Project 8 in Chapter 8 to give it a GUI that allows the user to write and read objects of type Pet to a file. Include a menu with options to create a new file, read an existing one, or exit. Create two files—named dogRecords and catRecords—and list them in a submenu under the read option. Hint: You can use this program to create the files dogRecords and catRecords. This project will require two testing phases, one before and one after creating the files, but that is not a major problem.

This is one of the more complicated problems in the text. While it is not difficult to create the menus, building and viewing files is another matter. As is often the case, it is easier to create the interface first, then add functionality a piece at a time. The user interface for the solution shown here a main window to display or enter data, and a pop-up window to enter the file name. The data window does not show text areas until a file has been opened to read or write. One dilemma is that the view option cannot be tested unless files with PetRecord records can be built, and, vice versa, the build option cannot be tested unless it is possible to view the files. One way around this dilemma is to use PetFileReadOrWrite from Chapter 10 Programming Project 9 to create the files

See the code in PetFilerGUI.java. Uses PetRecord.java.

Computer Science & Information Technology

You might also like to view...

Game controllers are output devices

Indicate whether the statement is true or false

Computer Science & Information Technology

What can be done to ensure that unauthorized changes are not made to a workbook?

What will be an ideal response?

Computer Science & Information Technology