Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions