Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started