Question: Write three classes based on the following UML Class Diagram. Fruit DryFruit FleshyFruit The Fruit class Has a private static int that keeps track of

 Write three classes based on the following UML Class Diagram. Fruit

Write three classes based on the following UML Class Diagram. Fruit DryFruit FleshyFruit The Fruit class Has a private static int that keeps track of the total instances of Fruit that have been created. Initialize it to 0; Its getter is named public static int getNumberOfFruit0 A no-arg constructor. Make it update the static variable discussed above. A protected instance variable String name, which is initialized to "". Has a public String whatAmI0 method, that returns the string "Fruit Overrides the toString0 method to return the result of the whatAml0 method. . The DryFruit class A constructor: public DryFruit(String name) Overrides the whatAml0 method to return the String "Dry Fruit: +name Overrides the equals(Object) method to return true if both objects are instances DryFruit and the names are equal. (do not simply use) Do not override the toString) method. The FleshyFruit class .A constructor: public FleshyFruit(String name) Overrides the whatAml0 method to return the String "Fleshy Fruit:"+name .Overrides the equals(Object) method to return true if both objects are instances FleshyFruit and the names are equal. (do not simply use) Do not override the toString0 method

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 Databases Questions!