122k views
2 votes
Read two doubles as the age and the weight of a chicken object. declare and assign pointer mychicken with a new chicken object using the age and the weight as arguments in that order. then call mychicken's increaseage() member function. ex: if the input is 3.5 2.5, then the output is: chicken's age is increased. What does the increaseAge() member function do in the Chicken class?

A. Increases the chicken's weight
B. Displays a message indicating the increase in age
C. Decreases the chicken's age
D. Creates a new chicken object

User Bindi
by
7.6k points

1 Answer

2 votes

Final answer:

The increaseAge() member function in the Chicken class increases the chicken's age and displays a message indicating the increase.

Step-by-step explanation:

The increaseAge() member function in the Chicken class does the following:

  1. Increases the chicken's age: The member function updates the age of the chicken object by incrementing it by a certain value. For example, if the chicken's initial age is 3.5 years, calling increaseAge() would increase it to a new value.
  2. Displays a message indicating the increase in age: After increasing the age, the function displays a message to notify the user that the chicken's age has been increased. This helps in tracking the changes made to the chicken object.

In this case, when the increaseAge() member function is called, it will increase the age of the chicken object created using the input values of 3.5 and 2.5. The output will be a message indicating that the chicken's age is increased.

User Mouhammed
by
7.6k points