4.8k views
2 votes
Read two doubles as the age and weight of a chicken object, declare and assign pointer mychicken with a new chicken object using the age and weight as arguments, then call mychicken's increaseage() member function. If the input is 3.5 and 2.5, then the output is:

a) Chicken's age is increased.

b) Chicken's weight is increased.

c) Chicken's age and weight are increased.

d) No output is produced

User Markusk
by
8.9k points

1 Answer

0 votes

Final answer:

The question involves creating a chicken object with age and weight attributes and then calling its increaseage() function. Based on that, only the chicken's age would be increased, making the correct answer option a) Chicken's age is increased.

Step-by-step explanation:

The question pertains to the creation and manipulation of a chicken object in a programming context, likely within an object-oriented programming language. After reading two doubles for age and weight, you are asked to create a new chicken object with these values and then call a member function to increase the chicken's age. Given the input of 3.5 for age and 2.5 for weight, and assuming the increaseage() function is designed to increase only the age attribute of the chicken object, the correct answer would be that only the chicken's age is increased.

If we consider a pseudo-code for this scenario, it might look something like this:

double age = 3.5;
double weight = 2.5;
Chicken* mychicken = new Chicken(age, weight);
mychicken->increaseage();

In this case, since only the increaseage() method is called, only the chicken's age will be affected.

User Alimon Karim
by
8.2k points