Inheritance Program (Animal Movements)

Nov 29th, 2013
RockCafe
Category:
Other
Price: $5 USD

Question description

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

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Boston College
PREMIUM TUTOR

Studypool has helped 1,244,100 students

3 Reviews


Summary
Quality
Communication
On Time
Value
BlueOcean
Nov 17th, 2016
" Awesome! Exactly what I wanted. "
ashleyisgod
Oct 25th, 2016
" Top quality work from this guy! I'll be back! "
Molly_Moon
Oct 3rd, 2016
" AMAZING as always! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors