Question
(5) The Animal Planet Channel wants to study the genetics of elk. (a) Create a record (not an object) to represent the following: One elk,
(5) The Animal Planet Channel wants to study the genetics of elk.
(a) Create a record (not an object) to represent the following:
One elk, representing the following properties or characteristics:
(1) gender ('M' or 'F')
(2) weight (in pounds, to the nearest tenth of a pound).
(3) age (rounded down to the nearest year)
(b) Inside the class with the main program (called TestElk),
(b.1) Write a subprogram that generates a new elk given its gender and its two parents.
Use the parameter list for the input (the two parent elk and the gender of the child).
Use the return statement for the result (the baby elk).
Use the following rules to define the remaining properties of the baby elk:
(i) the age is always zero.
(ii) The weight of the child is ...
c = w m
where
c = child's weight
w = weight of the father
m = multiplier, as follows
mother's age multiplier
age
5 age
12 age 0.06
(b.2) Write a main program that considers a herd of elk.
(1) Declare two variables to represent the breeders of a small herd (one male and one female).
(2) Assign the properties of the male: Age: 4 Weight: 220
(3) Assign the properties of one female. Ask the user to enter the age and weight.
(Check the age for errors . Repeat the question until the user enters a positive
number less than 20. To save time, do NOT check the weight for errors.)
(4) Compute the total weight of all the newborn babies over the next 10 years.
Each year there is one male child of the two breeders.
Each year the age of the parents increases by one.
(5) Display the total weight of all the newborns (at birth).
(The total weight is the sum of the 10 weights.)
(6) Repeat steps 3 through 5 until the user chooses to quit.
(5) The Animal Planet Channel wants to study the genetics of elk. (a) Create a record (not an object) to represent the following: One elk, representing the following properties or characteristics: (1) gender ('M' or 'F') (2) weight (in pounds, to the nearest tenth of a pound). (3) age (rounded down to the nearest year) (b) Inside the class with the main program (called TestElk), (b.1) Write a subprogram that generates a new elk given its gender and its two parents. Use the parameter list for the input (the two parent elk and the gender of the child). Use the return statement for the result (the baby elk). Use the following rules to define the remaining properties of the baby elk: (i) the age is always zero. (ii) The weight of the child is ... c=wm where c=child's weight w = weight of the father m = multiplier, as follows mother's age multiplier age 5, 0.11 5
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