Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include using namespace std;

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

=+ What scenarios could draw the audience in?

Answered: 1 week ago