Question: ageValue and weightValue are read from input. Declare and assign pointer myGoat with a new Goat object. Then, set myGoat's age and weight to ageValue

ageValue and weightValue are read from input. Declare and assign pointer myGoat with a new Goat object. Then, set myGoat's age and weight to ageValue and weightValue, respectively. #include
using namespace std;
class Goat {
public:
Goat();
void Print();
int age;
int weight;
};
Goat::Goat(){
age =0;
weight =0;
}
void Goat::Print(){
cout << "Goat's age: "<< age << endl;
cout << "Goat's weight: "<< weight << endl;
}
int main(){
int ageValue;
int weightValue;
/* Additional variable declarations go here */
cin >> ageValue;
cin >> weightValue;
/* Your code goes here */
myGoat->Print();
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!