(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)...


(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'sagemultiplier



age 0.11



5 ≤ age 0.08



12 ≤ age0.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.



WARNING: Write the subprogram according to its specifications. Do not simplify it for this particular main program. Write a subprogram that will work with other applications as well.

Mar 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here