Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Java Please Problem: Coffee Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has

Code in Java Please

Problem:Coffee

Design and implement a program that manages coffees. First, implement an abstract class namedCoffee.The Coffee class has three member variables: coffee type, price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interfaceHowToMakeDrink. The interface has the following method:

public interfaceHowToMakeDrink{

public void prepare ();

}

Thepreparemethod will simply print out the type of drink (Coffee Mocha) and all ingredients of the drink to the screen. Implement four derived classes namedWhititeChocolateMocha,DarkChocolateMocha,CoffeeMocha,andPeppermintMocha.

Assign the appropriate value for chocolate Type for the first two classes. Add a peppermintSyrubAmount member variable to thePeppermintMochaclass including a getter and setter function. Add a constructor to each class that sets the values of all properties. Override theprepare ()method in each subclass by printing the coffee/class and ingredients using the defined properties in that class.

Code 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 createe 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 typeee and ingredients of each drink to the console. Creating objects for testing all classes and all methods in the main method.

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

Mail - Jitwan Singh - Outlook x Content X + X C O...

Answered: 1 week ago