Menu

[Solved]Cosc 1336 Spring 2019 Homework 9 Due Monday April 22 Submission Instructions Submit Midnig Q37200911

Thank you. If possible, please provide extra credit aswell.
COSC 1336-Spring 2019 Homework #9 Due: Monday, April 22 Submission Instructions Submit by midnight on the due date and includCOSC 1336-Spring 2019 Homework #9 Due: Monday, April 22 Submission Instructions Submit by midnight on the due date and include your submission (a zip file) as an attachment. Assignment Design a class named Animal. An Animal object has the following data members: name (String), age (integer), amount- food-caten-per-day (integer, representing ounces) and a preferred food (String). Create a toString0 method in the Animal class. default values to the 4 data members as follows: Create a no-arg constructor method that sets nameunknown age 0 amount 0 food- “none In a separate java file create another class with a main method In the main method perform the following processing: Create an array of 15 Animal objects. Initialize the array of Animal objects with random data as follows: name will be one from “Rhino, “Deer”, Snake “Elephant” “Cat age will be from 2-15 amount-will be from 5-50 food will be one from “Grass”, “Oats”, “Fish”, “Meat Sort the array of Animal objects in order of age. Print the array using the toString0 method in the Animal class, one Animal per line (15 total lines of output). Print the total cost per day to feed all Rhino’s (I line of output). Print the total cost per day to feed all Deer (1 line of output). Print the total cost per day to feed all Snakes (I line of output). Print the total cost per day to feed all Cats (1 line of output). An example of the above output (for Cats) is: The total cost to feed Cats per day is $34 The cost to feed an animal per day is the amount of food eaten per day multiplied by the cost of the food the animal eats. Food costs, in dollars, are: Grass- 1 Oats-2 Fish-5 Meat-8 Extra Credit (10%) Find and print the animal that is the most expensive to feed Show transcribed image text COSC 1336-Spring 2019 Homework #9 Due: Monday, April 22 Submission Instructions Submit by midnight on the due date and include your submission (a zip file) as an attachment. Assignment Design a class named Animal. An Animal object has the following data members: name (String), age (integer), amount- food-caten-per-day (integer, representing ounces) and a preferred food (String). Create a toString0 method in the Animal class. default values to the 4 data members as follows: Create a no-arg constructor method that sets nameunknown age 0 amount 0 food- “none In a separate java file create another class with a main method In the main method perform the following processing: Create an array of 15 Animal objects. Initialize the array of Animal objects with random data as follows: name will be one from “Rhino, “Deer”, Snake “Elephant” “Cat age will be from 2-15 amount-will be from 5-50 food will be one from “Grass”, “Oats”, “Fish”, “Meat Sort the array of Animal objects in order of age. Print the array using the toString0 method in the Animal class, one Animal per line (15 total lines of output). Print the total cost per day to feed all Rhino’s (I line of output). Print the total cost per day to feed all Deer (1 line of output). Print the total cost per day to feed all Snakes (I line of output). Print the total cost per day to feed all Cats (1 line of output). An example of the above output (for Cats) is: The total cost to feed Cats per day is $34 The cost to feed an animal per day is the amount of food eaten per day multiplied by the cost of the food the animal eats. Food costs, in dollars, are: Grass- 1 Oats-2 Fish-5 Meat-8 Extra Credit (10%) Find and print the animal that is the most expensive to feed

Expert Answer


Answer to COSC 1336-Spring 2019 Homework #9 Due: Monday, April 22 Submission Instructions Submit by midnight on the due date and i… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *