[Solved]Lab Purpose Program Use C Inberitance Create Base Class Derived Class Also Working Constru Q37206529

Lab Purpose For this program, you will use C++ inberitance to create a base class and a derived class. You will also be working with constructors and redefining class member functions. Always bring to class I. Gaddis book, How-to handouts from Canvas and your class notes. 2. This assignment sheet& the grade shect for this lab already printed out. 3. USB Flash drive(s) or other storage media. Mandatory Instructions I. The base class Dog is a class with general information about dogs. Store the declaration for this class in a file called lab8dog.h. The class has three protecied data members to store dog’s name, color and weight. Include a prototype for a 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 functions 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. – Definc 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 display Dog. It should first call the base class version of the function (to display the dog’s name, color and weighr) and then display the mumber of contests entered by the dog and the mumber 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 Toto was entered in 5 contests Toto won 2 of the contests. (first three lincs are printed by base class displayDog function) 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 “Uggic”, “Blk/Wht”, 30, – Call the display Dog function to display the information about cach of these objects. Optional Instructions In your main function, define an array with four elements to hold pointers to objects of type Dog Dynamically allocate either a Dog or a ShowDog object, storing the pointer to the object (an address) in the next element of the array Use the dog data from the table shown below to create and initialize each new object in your program dogList 10)new Dog (“Bingo”, 20, “Tan”) i Bingo 20 Brown Yellow Rust Marley 80 50 10 Fido Then write a loop to display (i.с., call the displayDog() method) the data for cach object in the array Tip: In the header file for the Dog class, make your displayDog function virtual. Also, add an inlined virtual destructor to the Dog class: virtual Dog I (This prevents a warning message from the compiler.) Example output: Bolt og’s color White og’s weight: 20.80 og’s nane:Uggie oy’s color: B og’s weight: 30.00 ggie was entered in 3 contess. ggie won 1 of the contests. Dos’ nane Bingo og’s color: Tan Dog’s weight: 28.00 Dog’s nane Beethoven og’s color: Broun og’s ueight: 280.ue Beethoven was entered in 3 contess. Beethoven von 1 of the contests Dog’s nane Marles og’s color: Yellou og’s weight: 80.00 rley was entered in 10 contess. rley won 3 of the contests Dog’s nane:Fido og’s color: Rust og’s veight: 58.86 Press any key to contine .._ Show transcribed image text Lab Purpose For this program, you will use C++ inberitance to create a base class and a derived class. You will also be working with constructors and redefining class member functions. Always bring to class I. Gaddis book, How-to handouts from Canvas and your class notes. 2. This assignment sheet& the grade shect for this lab already printed out. 3. USB Flash drive(s) or other storage media. Mandatory Instructions I. The base class Dog is a class with general information about dogs. Store the declaration for this class in a file called lab8dog.h. The class has three protecied data members to store dog’s name, color and weight. Include a prototype for a 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 functions 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. – Definc 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 display Dog. It should first call the base class version of the function (to display the dog’s name, color and weighr) and then display the mumber of contests entered by the dog and the mumber 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 Toto was entered in 5 contests Toto won 2 of the contests. (first three lincs are printed by base class displayDog function) 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 “Uggic”, “Blk/Wht”, 30,
– Call the display Dog function to display the information about cach of these objects. Optional Instructions In your main function, define an array with four elements to hold pointers to objects of type Dog Dynamically allocate either a Dog or a ShowDog object, storing the pointer to the object (an address) in the next element of the array Use the dog data from the table shown below to create and initialize each new object in your program dogList 10)new Dog (“Bingo”, 20, “Tan”) i Bingo 20 Brown Yellow Rust Marley 80 50 10 Fido Then write a loop to display (i.с., call the displayDog() method) the data for cach object in the array Tip: In the header file for the Dog class, make your displayDog function virtual. Also, add an inlined virtual destructor to the Dog class: virtual Dog I (This prevents a warning message from the compiler.) Example output: Bolt og’s color White og’s weight: 20.80 og’s nane:Uggie oy’s color: B og’s weight: 30.00 ggie was entered in 3 contess. ggie won 1 of the contests. Dos’ nane Bingo og’s color: Tan Dog’s weight: 28.00 Dog’s nane Beethoven og’s color: Broun og’s ueight: 280.ue Beethoven was entered in 3 contess. Beethoven von 1 of the contests Dog’s nane Marles og’s color: Yellou og’s weight: 80.00 rley was entered in 10 contess. rley won 3 of the contests Dog’s nane:Fido og’s color: Rust og’s veight: 58.86 Press any key to contine .._
Expert Answer
Answer to Lab Purpose For this program, you will use C++ inberitance to create a base class and a derived class. You will also be … . . .
OR

