Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is an open book and open notes programming test. Answer all questions. For partial credit, show your work. The figure shows the Animal &

image text in transcribed
This is an open book and open notes programming test. Answer all questions. For partial credit, show your work. The figure shows the Animal & Plant classes and the Edible interface hierarchies. These classes are the parents of the classes described below: The Ant class defines a single function as in the figure. The Plant class has one non-abstract child class, okra. Interface Edible defines a single function, as in the figure. The classes shrimp & okra implement the Edible interface, as shown in the figure. From the description above complete the following the following: In your development create a new directory, called Test 2. Using friction and class names exactly as given in the description and figures above, create java classes to design and represented that hierarchy. Place these files include the Teat 2 directory. Besides the files created for this test, there should be no other files of any type in the Test 2 directory. For each class, define two constructors a default no-argument constructor, and a constructor that assign values to all the member variables, including the variables defined in the class parent if any Adding getter and setter methods, in addition to the ones in the figure is entirely optional you can only use constructors to assign values to class instance variables from your Driver Main.java) test program. Use function return types exactly as given in the figure. All class level member variables must be defined as private Again, class level variables are private. Points will be deducted if this requirement or any other stated requirement is not fulfilled. Create a Driver.java (or Main.java) class that has a main() function to test your implementation. In the Driver, create one object of type Ant and one object of type shrimp. Use the constructors create in the classes to instantiate the objects with the following information to test your implementation. Ant [name. "Fire ant", heart rate 114, habitat = "Tropical"] shrimp [name = "Pacific Pink Shrimp", heart rate = 118, taste = "mildly buttery"]. Add print statements to display the data stored in each object. Compile and run the Driver (or Main). Make sure it displays an output similar to the one shown below. This is an open book and open notes programming test. Answer all questions. For partial credit, show your work. The figure shows the Animal & Plant classes and the Edible interface hierarchies. These classes are the parents of the classes described below: The Ant class defines a single function as in the figure. The Plant class has one non-abstract child class, okra. Interface Edible defines a single function, as in the figure. The classes shrimp & okra implement the Edible interface, as shown in the figure. From the description above complete the following the following: In your development create a new directory, called Test 2. Using friction and class names exactly as given in the description and figures above, create java classes to design and represented that hierarchy. Place these files include the Teat 2 directory. Besides the files created for this test, there should be no other files of any type in the Test 2 directory. For each class, define two constructors a default no-argument constructor, and a constructor that assign values to all the member variables, including the variables defined in the class parent if any Adding getter and setter methods, in addition to the ones in the figure is entirely optional you can only use constructors to assign values to class instance variables from your Driver Main.java) test program. Use function return types exactly as given in the figure. All class level member variables must be defined as private Again, class level variables are private. Points will be deducted if this requirement or any other stated requirement is not fulfilled. Create a Driver.java (or Main.java) class that has a main() function to test your implementation. In the Driver, create one object of type Ant and one object of type shrimp. Use the constructors create in the classes to instantiate the objects with the following information to test your implementation. Ant [name. "Fire ant", heart rate 114, habitat = "Tropical"] shrimp [name = "Pacific Pink Shrimp", heart rate = 118, taste = "mildly buttery"]. Add print statements to display the data stored in each object. Compile and run the Driver (or Main). Make sure it displays an output similar to the one shown below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions