Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA: Creating methods to create an Espresso Machine Program. I need to create a class that has the correct constructors, setters, getters, and methods. Your

JAVA: Creating methods to create an Espresso Machine Program. I need to create a class that has the correct constructors, setters, getters, and methods.

Your program shall accomplish the following:

Define a class named Driver to be the driver program and a class named EspressoMachine that has all the appropriate private member variables, constructors, getters and setters

The EspressoMachine shall have private member variables of: private double ouncesPerCup; private double maxGroundsCapacity; private double currentGroundsLevel;

The EspressoMachine constructors shall default the ouncesPerCup value to 2.0 and call the setters to set the values.

The EspressoMachine SET_CURRENT_GROUNDS_LEVEL method shall ensure the currrent level does not exceed the max capacity

The EspressoMachine class shall also have extra additional methods: public void addGrounds(double grounds) that allows the user to add more grounds to the machine (in ounces) and ensures the current level does not exceed the max public String orderCupOfEspresso() that returns a string saying Enjoy this robust cup of espresso. ** BUT ** if the current level of espresso grounds is less than the ounces per cup, return the string We regret the machine is out of espresso. public String toString() that returns string representing the internal state of the machine (see the screenshot)

Prompt the user for the (double datatype) MAX CAPACITY and CURRENT LEVEL (in ounces) with which to call the two-argument constructor of the epresso machine Then, within a loop, prompt the user as to whether they'd like to order a cup of espresso, or add grounds to the machine, or quit the program.

It should look like this. I am so lost, I am trying to set up setters and getters but my professor did an awful job explaining how to include user input. Any sort of help would be appreciated.

image text in transcribed

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago