Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Problem:

Coffee Mocha 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.

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

(-4/9) (-3/20) Perform the indicated operation by hand.

Answered: 1 week ago