Question: Create the following classes: Pet and RunSystem Class Pet Has attributes of: PetName String; default value not assigned. PetType String; default value not assigned. PetID

Create the following classes: Pet and RunSystem

Class Pet

Has attributes of:

PetName String; default value not assigned.

PetType String; default value not assigned.

PetID String; default value ;

Every object of type pet must have all three attributes.

Create the necessary get and set methods.

Class RunSystem (main)

Create an array of type Pet. Preferable a 2D array. Allow for 5 entries.

Create any other variables needed.

Start an infinite loop.

Ask the user what they want to do:

  1. Add a Pet
  2. Delete a Pet
  3. Update a Pets name
  4. Display a list of all pets: name, type and ID

If they choose number 1 then ask for the pet name and type. Generate the next pet id. Create an object of type pet and put it in the array.

If they choose number 2, then ask for the pet id. Search the array for a matching id and delete the pet object.

If they choose number 3, then ask for the old name and the new name. Ask for the pet id and then update the record. Notify if the record is not found.

If they choose number 4, list all the pets by ID, name and type.

Note- to delete a pet, since we are using an array, you will have to create null values for the pet to be deleted. You can set the String values to or null.

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!