Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Help _________________________________________ Implement the ULM diagram above. Separate files for each class. Each class with a constructor and toString() method. toString() will return a

Java Help

_________________________________________image text in transcribed

Implement the ULM diagram above. Separate files for each class. Each class with a constructor and toString() method. toString() will return a String with the labeled variables of each member variables.

The constructor will accept the name as an argument (as many arguments). Use super() to call the base class constructor and pass up the name.

From each of the 3 subclasses above derive 2 classes of your own. You can choose to add more member variables or just use the inherited from the parent classes. Provide each class with a constructor that sets of all the member variables, both local and inherited. Use super() to pass the name up the base class constructor.

In main() create an array of 6 items. Assign each element an object from each of your classes. Use a for loop to call toString() on all 6 elements. Display the Strings as they are returned.

Example

Class chocolateCake extends Dessert {

ChocolateCake () {

super(Chocolate Cake);

price = 4.99f;

}

}

Item name description price calories String String float int Item(String name) toString Beverage Entre Dessert sugarFree bool hot alcoholic oz Sizes size bool bool float enum Sizes vegetarian Category category bool enum Catagory Entree(String name) toString Dessert(String name) toString Beverage(String name) toString

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

What metaphors might describe how we work together?

Answered: 1 week ago

Question

What are some of the possible scenes from our future?

Answered: 1 week ago