In this assignment you will create a simple “Pet Application” to view pet data stored in a database.

Application Description

  • Pet data is stored in a binary file called “petdata.dat” as a set of Pet objects.
  • Fish, Reptile and Mammal are child classes of the Pet class. The petdata.dat file stores data about all three kinds of pets in no particular order.
  • The binary file is provided along with this assignment as are the Pet, Fish, Mammal and Reptile class definitions. Note you do not need to anything with the class definitions. They are just being given to you to help you understand what the Pet and its child classes contain. You also need them to get your application to work. Hence the .class files for these class definitions must be placed in the same folder as your application program
  • The application should begin by reading the binary file data into an ArrayList and then displaying the form as shown below. Data from the first pet record in the binary file should be displayed in the form. Note that only the fields appropriate for the type of pet the data applies to, must be shown. See image.

The form has textfields to hold the data from the Pet object, labels to describe each of the textfields, three buttons, three additional labels, one additional textfield and one menu item.

Functionality for the different buttons, the additional labels, the additional textfield and the menu item is as described below:

Labels: In addition to the labels for describing the textfields, there are three additional labels in this form.

Label 1: This label is the one at the top of the form and will display the title “Pet Data Application.

Label 2: This label will be placed at the bottom center of the form and will display messages to the user as described later.

Label 3: This label will be placed at the bottom right corner, before the Find button and identifies the textfield where the user will enter a Pet id to search for a specific Pet.

TextField: This extra textfield will be placed just before the Find button. When a user wishes to search for a specific Pet, the user will enter the PetID in this textfield.

Buttons: There are three buttons for which functionality is to be implemented.

Next: When this button is clicked, data about the next pet in the file should be displayed in the form. If the record is already showing the last pet in the file, a message saying “Already at last record” should be displayed in a label at the center of the form (Label 2).

Previous: When this button is clicked, data about the previous employee in the file should be displayed in the form. If the record is already showing the first employee in the file, a message saying “Already at first record” should be displayed in a label at the center of the form (Label 2).

Find: When this button is clicked:

  • If the user clicks this button without entering a petId in the textfield, display a message in Label 2, saying “Enter a Pet ID before clicking the button!”
  • If the user enters a pet ID and clicks Find, search the arraylist to find the correct pet data and display it in the form.
  • If the user enters an id that does not exist, display a message in Label 2 saying “Pet not found!! Displaying first pet!” and display pet data for the first Pet in the file.

Exit: This menuItem should part of the File menu. When this menu item is selected, data should be written back to the binary file as a set of Pet objects.

Included is an executable file of the application. You can execute this application and see exactly what is required. Grading will be based on your application performing like the one I have uploaded. See the sample .jar program and .dat file provided.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.