Question: In Java CSC 222 Assignment 5 Topics: class, Objects, array Effort: 10+ hours Number of lines: Less than 200. This assignment will give you practice

In Java

In Java CSC 222 Assignment 5 Topics: class, Objects, array Effort: 10+

hours Number of lines: Less than 200. This assignment will give you

practice writing a class, creating objects, updating an object, storing objects in

an array and searching an array of objects. You will create a

basic database program for managing information (name and age) about pets. The

database allows the user to add pet information to the database, remove

CSC 222 Assignment 5 Topics: class, Objects, array Effort: 10+ hours Number of lines: Less than 200. This assignment will give you practice writing a class, creating objects, updating an object, storing objects in an array and searching an array of objects. You will create a basic database program for managing information (name and age) about pets. The database allows the user to add pet information to the database, remove pet information, updating pet information, and searching for pets by name or by age. You can assume the user only input pet names consisting of a single word. Error handling is optional. Pet class: You will need a Pet class to represent possible pets. The table below provides all the properties and methods of the Pet class. Notice the UML notation. The () and (+) indicate private and public. The type following (:) indicates the variable data type or the return type of a method. PetDatabase Class: You will write a main class named PetDatabase that manages an array of Pet objects. The program allows the user to view all the pet objects, search pets by name, or by age. Below are the methods for the PetDatabase class. Notice that all the variables and methods for the PetDatabase class are static. PetDatabase Class: You will write a main class named PetDatabase that manages an array of Pet objects. The program allows the user to view all the pet objects, search pets by name, or by age. Below are the methods for the PetDatabase class. Notice that all the variables and methods for the PetDatabase class are static. \begin{tabular}{|l|l|} \hline main:void & Containsthemainloopofyourprogram.Itcontainsnothingmorethanaswitchstatementinsidealoop.Eachcasestatementcallsamethodbelowbasedontheusersselection.Themainmethodusesalltheothermethodstodoallthework. \\ \hline -getUserChoice( ):int & Showsuserthechoicemenu,readsandreturnstheusersselection.Thechoicemenuliststheactionstheusercanperform.Seesamplerunforthecontentofthe \\ \hline \end{tabular} Table Formatting: Your program will display the results for view all pets, search pet by name and search pet by age using a table as shown below. You will need to use System.out.printf() to format the table. Below is a sample table with annotations as to which part is the header, rows, and footer. A row represents a single record about a pet. The ID is the index in the array the object is located. A table consists of zero more rows. You may use 3 characters for ID, 10 characters for NAME, and 4 characters for AGE. Submission: For ease of grading, submit your program as a single file. The main class should be PetDatabase which is the class with the keyword "public". The Pet class is inside the same .java file as the PetDatabase. Using a default package would also ease the grading but that's optional. Pet Database Program. add pet (name, age): Krazy 11 What would you like to do? add pet (name, age): done 1) View all pets 1 pets added. 2) Add more pets What would you like to do? 3) Update an existing pet 1) View all pets 4) Remove an existing pet 2) Add more pets 5) Search pets by name 3) Update an existing pet 6) Search pets by age 4) Remove an existing pet 7) Exit program 5) Search pets by name Your choice: 2 6) Search pets by age add pet (name, age): Kitty 8 7) Exit program add pet (name, age): Bruno 7 Your choice: 1 add pet (name, age): Boomer 8 add pet (name, age): Boomer 3 add pet (name, age): Fiesty 3 add pet (name, age): done 5 pets added. What would you like to do? 1) View all pets 2) Add more pets 3) Update an existing pet 4) Remove an existing pet 5) Search pets by name 6 rows in set. 6) Search pets by age 7) Exit program What would you like to do? Your choice: 1 1) View all pets 2) Add more pets 3) Update an existing pet 4) Remove an existing pet 5) Search pets by name 6) Search pets by age 7) Exit program Your choice: 3 5 rows in set. What would you like to do? 1) View all pets 2) Add more pets 3) Update an existing pet 4) Remove an existing pet 5) Search pets by name 6) Search pets by age 7) Exit program 6 rows in set. Your choice: 2 Enter the pet ID you can to update: 1 Enter new name and new age: Brunoozz 8 Bruno 7 changed to Brunoozz 8. What would you like to do? What would you like to do? 1) View all pets 1) View all pets 2) Add more pets 2) Add more pets 3) Update an existing pet 3) Update an existing pet 4) Remove an existing pet 4) Remove an existing pet 5) Search pets by name 5) Search pets by name 6) Search pets by age 6) Search pets by age 7) Exit program 7) Exit program Your choice: 1 Your choice: 1 5 rows in set. What would you like to do? 6 rows in set. 1) View all pets What would you like to do? 2) Add more pets 1) View all pets 3) Update an existing pet 2) Add more pets 4) Remove an existing pet 3) Update an existing pet 5) Search pets by name 4) Remove an existing pet 6) Search pets by age 5) Search pets by name 7) Exit program 6) Search pets by age Your choice: 5 7) Exit program Enter a name to search:boomer Your choice: 4 2 rows in set. What would you like to do? 1) View all pets 2) Add more pets 3) Update an existing pet 6 rows in set. 4) Remove an existing pet Enter the pet ID to remove: 1 5) Search pets by name Brunoozz 8 is removed. 6) Search pets by age 7) Exit program Your choice: 6

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 Databases Questions!