Saved Abstract class name is Fruit. Banana, Apple, Lemon and Orange are classes derived from Fruit class that will override unimplemented method taste() found in the base class. A message must be printed indicating the taste of banana, apple, lemon, and orange. Let's say the taste is delicious for banana, juicy for apple, sour for lemon, and sugary for orange. a) Ihave provided you with the source for the Fruit. Here is a summary of the properties and constructors for each class. Each class has accessors and mutators for the properties. Where do you think is appropriate to show them? public abstract class Fruit { private double cost; private String color; public Fruit ( String color, double cost ){ Il complete this body public abstract void taste(): @Override public String toString) | return getClass).toString().substring(6)+" [cost=" + cost + ", color=" + color + "I": b) Implement the four classes Banana, Apple, Lemon and Orange. c) Create a driver class, in the main method, create a reference of type base class points to an object of type Banana, and call all its methods. d) Use the same base class reference to create another object of type Apple, and call all its methods. e) Use the same base class reference to create another object of type Lemmon, and call all its methods. f) Use the same base class reference to create another object of type Orange, and call all its methods. g) Re-implement the same previous example using Interface Fruit instead of base class. h) Create a video lecture showing your work, you should appear in the video while you are presenting the lecture. i) Put all your java files into a compressed format file with the name your last name and first name, and upload it to the course Moodle. j) Submit your video lecture
Yasmeen Abd Hailat
Level 0
help me plz
Under discussion
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet