Question

In: Computer Science

JAVA programming - please ONLY answer prompts with java code *Inheritance* will be used in code...

JAVA programming - please ONLY answer prompts with java code *Inheritance* will be used in code

Classwork

A zoo is developing an educational safari game with various animals. You will write classes representing Elephants, Camels, and Moose.

Part A Think through common characteristics of animals, and write a class ZooAnimal.

☑ ZooAnimal should have at least two instance variables of different types (protected), representing characteristics that all animals have values for.

☑ It should also have at least two methods for behaviors that all animals do; these can simply print out a String stating what the animal is doing. (accessors and mutators are not behaviors). Include at least one parameterized constructor. Part B

☑ Create classes Elephant, Camel, and Moose, all of which extend ZooAnimal. In each, include a default constructor that calls the parameterized superclass constructor

. ☑ To one class (of Elephant, Camel, and Moose), add another instance variable specific to that type of animal. To another, add another behavior method. In a third, override a behavior from ZooAnimal. Part C

☑ Create a test harness for the animal classes. In a main create at least one Elephant, Camel, and Moose, and show which behavior methods are usable for each.

☑ [EC+10] Create another animal class inheriting from one of your three types (doesn't have to be zoologically accurate, but should make some sense), and either add an instance variable or add or override a method. This class should also be tested in the harness.

Solutions

Expert Solution


Related Solutions

JAVA programming Classwork- please answer all prompts as apart of one java programming project Part A...
JAVA programming Classwork- please answer all prompts as apart of one java programming project Part A Add to your project this class Position, which has x and y coordinates. Create an abstract class GameElt, which has a String name, an int health (keep it in the range 0 to 100) and a Position pos. For GameElt, include a default constructor that starts pos at (0, 0), and a parameterized constructor that takes x and y coordinates and a name. health...
JAVA programming - please answer all prompts as apart of 1 java assignment. Part A Create...
JAVA programming - please answer all prompts as apart of 1 java assignment. Part A Create a java class InventoryItem which has a String description a double price an int howMany Provide a copy constructor in addition to other constructors. The copy constructor should copy description and price but not howMany, which defaults to 1 instead. In all inheriting classes, also provide copy constructors which chain to this one. Write a clone method that uses the copy constructor to create...
JAVA code - please answer all prompts as apart of the same java program with Polymorphism...
JAVA code - please answer all prompts as apart of the same java program with Polymorphism Classwork Part A ☑ Create a class Employee. Employees have a name. Also give Employee a method paycheck() which returns a double. For basic employees, paycheck is always 0 (they just get health insurance). Give the class a parameterized constructor that takes the name; Add a method reportDeposit. This method prints a report for the employee with the original amount of the paycheck, the...
JAVA programming- please answer all prompts as apart of the same java project Enums enumeration values()...
JAVA programming- please answer all prompts as apart of the same java project Enums enumeration values() and other utilities Part A Create an enumeration AptType representing several different types of apartment. Each type of apartment has a description, a size (square footage), and a rent amount. In the enumeration, provide public final instance variables for these. Also write a parameterized constructor that sets the values of these variables (doing this is just part of seeing up the enum) The apartment...
JAVA programming- answer prompts as apart of one java assignment Static static variables static methods constants...
JAVA programming- answer prompts as apart of one java assignment Static static variables static methods constants Create a class Die representing a die to roll randomly. ☑ Give Die a public final static int FACES, representing how many faces all dice will have for this run of the program. ☑ In a static block, choose a value for FACES that is a randomly chosen from the options 4, 6, 8, 10, 12, and 20. ☑ Give Die an instance variable...
*****************PLEASE PROVIDE THE CODE IN RACKET PROGRAMMING LANGUAGE ONLY AND MAKE SURE CODE RUNS ON THE...
*****************PLEASE PROVIDE THE CODE IN RACKET PROGRAMMING LANGUAGE ONLY AND MAKE SURE CODE RUNS ON THE WESCHEME IDE************* Write a tail-recursive Racket function "kept-short-rec" that takes an integer and a list of strings as parameters and evaluates to an integer. The resulting integer should be the number of strings on the original list whose string length is less than the integer parameter. For example, (kept-short-rec 3 '("abc" "ab" "a")) should evaluate to 2 because there are only 2 strings shorter...
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME...
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME IDE*************** Write a recursive Racket function "keep-short-rec" that takes an integer and a list of strings as parameters and evaluates to a list of strings. The resulting list should be all of the strings from the original list, maintaining their relative order, whose string length is less than the integer parameter. For example, (keep-short-rec 3 '("abc" "ab" "a")) should evaluate to '("ab" "a") because...
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME...
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME IDE*************** Write a recursive Racket function "sum-diff" that takes two lists of integers that are the same length and evaluates to an integer. The resulting integer should be the sum of the absolute value of the differences between each pair of integers with the same index in the two lists. For example (sum-diff '(-1 -2 -3) '(1 2 3)) should evaluate to 12 because...
This is an entry to Java Question. Please answer with Pseudocode and Java code for better...
This is an entry to Java Question. Please answer with Pseudocode and Java code for better understanding. We are mainly using basic in and out declarations and are focusing on API for method invocations. Any help would be very appreciated :) Problem 7: Distance (10 points) Use API (Data Science) Data Science is an emergent field from Computer Science with applications in almost every domain including finances, medical research, entertainment, retail, advertising, and insurance. The role of a data analyst...
THIS IS JAVA PROGRAMMING Guessing the Capitals. Write a program Lab5.java that repeatedly prompts the user...
THIS IS JAVA PROGRAMMING Guessing the Capitals. Write a program Lab5.java that repeatedly prompts the user to enter a capital for a state (by getting a state/capital pair via the StateCapitals class. Upon receiving the user’s input, the program reports whether the answer is correct. The program should randomly select 10 out of the 50 states. Modify your program so that it is guaranteed your program never asks the same state within one round of 10 guesses.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT