Start a new project that includes the Super Class Animal and sub classes Frog, Fish, and Bird that extend the superclass Animal.
Define a main class called AnimalTest that instantiates and define objects of the various Animal subclasses and test all the methods in each class.
Define a class called Animal that stores the animal’s current location as x-y coordinates, the energy cost (in cal/g/m) needed for a move, the time required to do the move, and contains a reasonable complement of accessor and mutators, and four moving methods (moveUp, moveDown, moveRight, moveLeft)
Each move method contains a parameter that sets the number of steps of the move
Each subclass implements the method move but in a different way: a frog jumps one meter per step, a fish swims two meter per step, and a bird flies three meters per step.
The program will include a main menu with five options: Reset position, Set position, Show position, Move, Exit
The Move option
will call another menu with four options: Up, Down, Left, Right
after choosing the option of the main menu, the user will be offered another menu that allows him/her to choose the animal
the following step will be to get from the user the number of steps of the move
The program will apply the corresponding move methods that corresponds to the chosen animal and then will return to the main menu
A research is carried out to calculate to energy and time required by three animals to move between two given locations. A 1.5 kg salmon uses 0.0003 cal/g/m and needs 3 seconds to swim one meter. A 100 g blue jay uses 0.001 cal/g/m and needs 0.5 seconds to fly one meter. A 50 g tree frog uses 0.009 cal/g/m and needs 2 seconds to jump one meter.
Perform several moves with each animal to go between from (0,0) to (20,15) and compare the energy used by each of them and the time required for the move.
(Display the results when you terminate the program)
For example, if the coordinates of the salmon are (2,3) and the salmon swims three steps up, then the method moveUp(3) is applied to the fish and its new coordinates are (2,9). The salmon used (0.0003 cal/g/m)(1500 g)(6 m) calories in (3 s/m)(6m) second