Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions