Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this code in C++ please. Thank you please try the bonus I need the points big time, thanks! Mandatory Instructions 1.
I need help with this code in C++ please.
Thank you please try the bonus I need the points big time, thanks!
Mandatory Instructions 1. The base class Dog is a class with general information about dogs Store the declaration for this class in a file called labSdog.h. The class has three protected data members to store dog's name, color and weight Include a prototype fora default constructor that sets the name and color to the value "Unknown" and the weight to 0.0. Include a second prototype for a constructor that accepts values for the dog's name, color and weight and assigns them to the data members. Also, include a prototype for a function called displayDog to display the values of each data member. 2. Implement all member fiunctions for the Dog class in the file called lab8dog.cpp 3. Class ShowDog will be a derived class with additional information about dogs who have been entered in dog shows so a ShowDog"is a" Dog which means it will inherit from the Dog base class. Store the declaration for the ShowDog class in the file lab8show.h and define the functions in the file lab8show.cpp This class has two private data members -the number of contests a dog has been entered in and the number of contests it has won. Define a default constructor that sets these two fields to zero and invokes the Dog default constructor to initialize the inherited data members. Define a second constructor that accepts a dog's name, color, weight, number of contests entered and number won. Pass the first three arguments to the Dog constructor and use the last two to set the ShowDog's data members. Include a prototype for a function called displayDog. It should first call the base class version of the function (to display the dog's name, color and weight) and then display the mmber of contests entered by the dog and the number won. This function is redefining the base class version of displayDog. The function should produce an output like this: Dog's name: Toto Dog's weight: 25 Dog's color: Grey (first three lines are printed by base class displayDog function) Toto was entered in 5 contests, Toto won 2 of the contests. 4. Write a client program called labSclient.cpp to demonstrate the use of Dog and ShowDog classes. Define a Dog object initializing the name, color and weight with "Bolt", "White" and 20 Define a ShowDog object with arguments for all five data members using the values "Uggie", "Blk/Wht", 30, 3, 1 Mandatory Instructions 1. The base class Dog is a class with general information about dogs Store the declaration for this class in a file called labSdog.h. The class has three protected data members to store dog's name, color and weight Include a prototype fora default constructor that sets the name and color to the value "Unknown" and the weight to 0.0. Include a second prototype for a constructor that accepts values for the dog's name, color and weight and assigns them to the data members. Also, include a prototype for a function called displayDog to display the values of each data member. 2. Implement all member fiunctions for the Dog class in the file called lab8dog.cpp 3. Class ShowDog will be a derived class with additional information about dogs who have been entered in dog shows so a ShowDog"is a" Dog which means it will inherit from the Dog base class. Store the declaration for the ShowDog class in the file lab8show.h and define the functions in the file lab8show.cpp This class has two private data members -the number of contests a dog has been entered in and the number of contests it has won. Define a default constructor that sets these two fields to zero and invokes the Dog default constructor to initialize the inherited data members. Define a second constructor that accepts a dog's name, color, weight, number of contests entered and number won. Pass the first three arguments to the Dog constructor and use the last two to set the ShowDog's data members. Include a prototype for a function called displayDog. It should first call the base class version of the function (to display the dog's name, color and weight) and then display the mmber of contests entered by the dog and the number won. This function is redefining the base class version of displayDog. The function should produce an output like this: Dog's name: Toto Dog's weight: 25 Dog's color: Grey (first three lines are printed by base class displayDog function) Toto was entered in 5 contests, Toto won 2 of the contests. 4. Write a client program called labSclient.cpp to demonstrate the use of Dog and ShowDog classes. Define a Dog object initializing the name, color and weight with "Bolt", "White" and 20 Define a ShowDog object with arguments for all five data members using the values "Uggie", "Blk/Wht", 30, 3, 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started