Question: Use this UML to create a java code that can run in Eclipse Java Oxygen. Write the code to implement the following classes: 1. Product
Use this UML to create a java code that can run in Eclipse Java Oxygen.
Write the code to implement the following classes:
1. Product (make this class abstract)
2. Snack (make this class abstract)
3. Drink
4. Candy
5. Chips
6. Gum
7. Dispenser (add a constructor that populates the Dispenser class array with a variety of Products)
8. Finally, write a main method that creates a Dispenser and calls the Dispenser method displayProducts().

name String + Product( + Product(String name) + Product(Product p) + toString): String Orink weight: double price : double type: String price : double +Drink() + Drink(double price) + Drink(Drink d) + toString): Strin + Snack(double weight,double price) Snack(Snack s) + toString: Strin Cand calories: int flavour String + Gum() + Gum( String flavour) contents: String +Candy() +Candy(int calories) +Candy(Candy c) + toString():String Chips) Chips(String contents) + Chips(Chips c) toString): String +Gum(Gum g) +tostring) String
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
