Question: Given the following classes:a . Arrange the above classes into an appropriate inheritance hierarchy. Note: do NOT add fields or methods to any of these

Given the following classes:a. Arrange the above classes into an appropriate inheritance hierarchy. Note: do NOT add fields or methods to any of these classes.b. Implement the toString() method for each class each class, which prints "I am a YYY, which is child of MMM, which is child of PPP". For example, the Tomato class should print "This is Tomato instance, which is a child of FruitItem, which is a child of FoodItem".c. Implement a test class that instantiates a new instance for each class.2. Given the following Bike class:a. Complete the setter and getter forb. Implement the equals method to check if two bikes are equals. The equals method should test the equality based on the Bike class attributes: bikeld, name, and brand.c. Implement a test class that instantiates a new instance for each class.
Given the following classes:a . Arrange the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!