Question
Two doubles are read as the age and the weight of a Turkey object. Assign pointer myTurkey with a new Turkey object using the age
Two doubles are read as the age and the weight of a Turkey object. Assign pointer myTurkey with a new Turkey object using the age and the weight as arguments in that order.
Ex: If the input is 6.5 22.0, then the output is:
Turkey's age: 6.5 Turkey's weight: 22.0
#include
class Turkey { public: Turkey(double ageValue, double weightValue); void Print(); private: double age; double weight; }; Turkey::Turkey(double ageValue, double weightValue) { age = ageValue; weight = weightValue; } void Turkey::Print() { cout << "Turkey's age: " << fixed << setprecision(1) << age << endl; cout << "Turkey's weight: " << fixed << setprecision(1) << weight << endl; }
int main() { Turkey* myTurkey = nullptr; double ageValue; double weightValue;
cin >> ageValue; cin >> weightValue; /* Your code goes here */ myTurkey->Print(); return 0; }
c++ and please please make it correct
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