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

(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), (6.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: (1) the age is always zero. (11) 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 0.11 5 Sage < 12 0.08 12 Sage 0.06 (6.2) Write a main program that considers a herd of elk. age <5, (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. (12) A Torple is a single-celled organism that produces its own offspring. (Each has only one parent.) (a) Create a record to represent the following An individual Torple has the following properties or characteristics: (1) mode (‘A’ or ‘B’) (2) number of borts (a particle that cannot exist in fractional portions) (3) weight (in grams, to the nearest milligram; could be as large as one million) (4) efficiency (as little as 0.01, but could be up to, but not including, 10) (b) Write a subprogram that generates a new Torple given its parent. Use the following rules to define the properties of the new Torple. (1) The mode is always opposite: an ‘A’ parent generates a ‘B’ child and ‘B’ generates ‘A’. (ii) The number of borts stays the same if the parent is an ‘A’, otherwise it increases by one. (iii) The weight of the child is the weight of the parent times the efficiency of the parent. (iv) The efficiency of the child is dependent on the parent’s number of borts, as follows: increase borts <4, 0.05 4 <borts<9 0.20 9<borts 0.80 The efficiency of the new Torple is the efficiency of the parent plus the increase. If the new efficiency is greater than or equal to 10, reset it to 0.5 Use the parameter list for the input, and the return statement for the result. Create and return a new instance of Torple. (c) Write a main program that displays a table of Torple weights over 10 generations. (1) Start with a Torple with the following characteristics: mode ‘A’, 3 borts, and an efficiency of 0.10. (ii) Ask the user to enter the initial weight. Repeat the question until the user enters a positive number. (iii) Produce a table of the weights over the next 10 generations. – For each generation, display the generation (1,2,3,…) starting with the first torple and the weight of that generation. – Display column headings above the table. Gen Weight (g) – Use the subprogram in part (b) to compute each new generation of Torple. (Do not copy this code, or repeat the calculations.) (iv) Repeat steps (ii) and (iii) until the user chooses to stop. import java.util.Scanner; // continued on next page… class Torple { public char mode; public int borts; public double weight; public float efficiency, } public class Exami { public static Torple maketorple ( Torple parent ) float increase; Torple child = new Torple(); ‘B’ if ( parent.mode — ‘A’) child.mode else child.mode – ‘A’; child. borts – parent.borts; if ( parent.mode — ‘B’ ) ++child.borts; child.weight = parent.weight * parent.efficiency; if ( parent, borts <4) increase -0.05; else if ( parent.borts < 9) increase – 0.20; else increase – 0.8; child.efficiency – parent.efficiency + increase; if (child.efficiency >= 10 ) child.efficiency – 0.5; return child; } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); char another; Torple entity = new Torple(); do ! entity.mode – ‘A’, entity.borts – 3; entity.efficiency = 0.10; do { System.out.println(“\nEnter initial weight (grams): “); entity.weight = keyboard.next Double(); if ( entity.weight <= 0 ) System.out.println(“\nEnter a positive number\n”); } while ( entity.weight <=0); System.out.println(“\tGen\tWeight (g)” ); System.out.println(“\t 1\t” + entity.weight ); for (int i = 0; i < 10; ++i) { entity = ma ke Torple( entity ); System.out.println(“\t ” +(1+2) + “\t” + entity.weight ); } System.out.println(“\nAnother table (y/n)? ” ); another – keyboard.next().charAt(0); } while ( another — ‘y’ ); System.out.println(“\nHave a nice day \n” ); }

Essay Writers

How it works

You are only 4-steps away from a perfect custom essay.

1. Make an order
2. Wait for response
3. Monitor the process
4. Download Paper

GET A FREE QUOTE

Price: $
Open chat