Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ You will create a base class called Pet. The pet class will have private members: string fName (Owners first name), string lName (Owners last

C++

You will create a base class called Pet. The pet class will have private members: string fName (Owners first name), string lName (Owners last name), string pName (Pets name), double w (Pets weight), int m (Pets month of birth), int d (Pets day of birth), int y (Pets year of birth). Be sure to check to make sure the user enters a value that is greater than zero for the weight (w), birth month (m), and birth year (y). Create a constructor and sets and gets for all of the classs private variables. Create a print method to display the class information neatly. You will need to create the Pet class header file Pet.h.

You will create a class called Bird. This class will be derived from the base class Pet. Bird will use the base classs constructor as well as the variables string bc (Birds Color), and bb (Birds Breed) which should be private members of the Bird class. Create a constructor, and sets and gets for the Bird classs private member variables. Create a print method to display the class information neatly. Dont forget the Bird.h file too.

You will create a class called Cat. This class will be derived from the base class Pet. Cat will use the base classs constructor as well as the variables string cc (Cats Color, and string cb (Cats Breed) which should be private members of the Cat class. Create a constructor, and sets and gets for the Cat classs private member variables. Create a print method to display the class information neatly. Be sure to create the Cat.h file as well.

You will create a class called Dog. This class will be derived from the base class Pet. Dog will use the base classs constructor as well as the variables string cc (Dogs Color), and string cb (Dogs Breed) which should be private members of the Dog class. Create a constructor, and sets and gets for the Dog classs private member variables. Create a print method to display the class information neatly. You will need to create the Dog.h file also.

You will need to create an int displayMenu method that displays the menu and accepts the users input. The method should return the int choice to the main program. The menu should look like:

********Pet Program********

Please enter 1 for a Dog

Please enter 2 for a Cat

Please enter 3 for a Bird

Please enter 4 for other pets

Please enter 5 to exit the program

Your main program should call the displayMenu method allowing the user to enter the pet of their choice and displaying the results of their entry. The program should continue allowing the user to enter and display more pets until the user enters 5 to exit. The main should use a case/switch statement and switch on the users choice. Each case should call the corresponding print function for the class bind used. It works best to create your classes in separate if/else if statements below the cases and completely outside of the switch statement due to scope issues within the case statement.

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago