subject
Computers and Technology, 06.12.2021 16:30 Crxymia

The base class Pet has private data members petName, and petAge. The derived class Dog extends the Pet class and includes a private data member for dogBreed. Complete main() to: create a generic pet and print information using PrintInfo().
create a Dog pet, use PrintInfo() to print information, and add a statement to print the dog's breed using the GetBreed() function.
Ex. If the input is:
Dobby
2
Kreacher
3
German Schnauzer
the output is:
Pet Information:
Name: Dobby
Age: 2
Pet Information:
Name: Kreacher
Age: 3
Breed: German Schnauzer

the given code:
Main. cpp:
#include
#include
#include "Dog. h"
using namespace std;
int main() {
string petName, dogName, dogBreed;
int petAge, dogAge;
Pet myPet;
Dog myDog;
getline(cin, petName);
cin >> petAge;
cin. ignore();
getline(cin, dogName);
cin >> dogAge;
cin. ignore();
getline(cin, dogBreed);
// TODO: Create generic pet (using petName, petAge) and then call PrintInfo
// TODO: Create dog pet (using dogName, dogAge, dogBreed) and then call PrintInfo
// TODO: Use GetBreed(), to output the breed of the dog
}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 00:50, JakeCline
Which of the following is not a key player in the sale of travel products?
Answers: 2
image
Computers and Technology, 24.06.2019 03:00, 2020IRodriguez385
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
image
Computers and Technology, 24.06.2019 14:30, SmartScholar4094
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
image
Computers and Technology, 24.06.2019 15:50, GreatBaconGamer
Subscribe to j p g a m e t u b e on you tube ?
Answers: 2
You know the right answer?
The base class Pet has private data members petName, and petAge. The derived class Dog extends the P...

Questions in other subjects:

Konu
French, 20.07.2019 03:30
Konu
Chemistry, 20.07.2019 03:30