Question
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.
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