Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Coffee Mocha use ArrayList Implement a program that manages coffees. First, implement a class named Mocha. The Mocha class has three member variables: milkAmount,

Problem: Coffee Mocha

use ArrayList

Implement a program that manages coffees. First, implement a class named Mocha. The Mocha class has three member variables: milkAmount, espressoShot, chocolateType. The Mocha class implements an interface HowToMakeDrink. The interface has the following method:

public interface HowToMakeDrink {

public void prepare ();

}

The prepare function will simply print out the type of drink (CoffeeMocha) and all ingredients of the drink to the screen.

Implement three derived classes named WhiteChocolateMocha, DarkChocolateMocha, and PeppermintMocha. Assign the appropriate value for chocolateType for the first two classes. Add a peppermintSyrubAmount member variable to the PeppermintMocha class including a getter and setter function. Add a constructor to each class that sets the values of all properties. Override the prepare () function in each subclass by printing the coffee/class type and ingredients using the defined properties in that class.

Write a program that repeatedly shows the user a menu to create one of the three mocha drinks or to print all the drinks created so far. If the user selects to create a new mocha drink, the program prompts the user to enter the ingredients of the selected drink. If the user selects to print the current coffees, print the drink type and ingredients of each drink to the console. Creating objects for testing all classes and all functions in the main function. Please make sure to print what it is ask for.

Example: let's you run the project and from the menu choose a different object or the same object for number of the times. Now you choose print. The print must

print all the chosen coffee so far. (the history up to that time).Think of the end of the day Starbuck store want to know the whole sale.

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions