Question
java eclipse To do: You work at a coffee shop where you take drink orders. Create a class named Drinks with the following fields. Make
java eclipse
To do:
You work at a coffee shop where you take drink orders. Create a class named Drinks with the following fields. Make certain to include all methods required in our class blueprint.
private String drinkType;
private char size; (//NOTE valid values are S, M, or L for small, medium, large) private double costEach; private int numOrdered;
We are going to create an array of Drink instances in a driver named DrinkDriverArray and fill in data from the keyboard. We do not know how many there are ahead of time. We have examples of how to handle arrays of unknown size. Check out DogArrayUnknownSize.java. NOTE: it MUST be an array not an ArrayList. Lets assume that we will not have over 20 different drink orders so make your program to handle any number of them up to 20 (you do not need to write an increaseSize() method).
The main loop should just be reading in the data by asking the user for values for the four fields, creating the instances and placing them in the array. You can end the loop any way that you like.
Create methods shown in the UML diagram above.
(NOTE: since these methods are related to multiple orders, they must go in the driver class not the blueprint. The only thing that can go into the blueprint is anything that has to do with ONE Drink order.
After your loop in main(), call the three methods in d. above to print out the data and summaries.
since we do not know the size of the array, you will need a counter and each of the three methods above will have parameters of the Ticket array and that counter. Check out the DogArrayListUnknownSize. For similar calculations, also check out the BandBoosters (except that one is a full array, so you will need to pass in the counter that indicates how many pieces of data are actually valid).
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