Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Code Description: We have been hired by a local coffee house to build them a simple order placement system Since we have begun discussing

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Java Code

Description: We have been hired by a local coffee house to build them a simple order placement system Since we have begun discussing "queues" as a tool, this presents us with a perfect opportunity to utilize them in our program. Packaging: Fully qualified class names are listed below: (Note: the bold is the class itself) edu.ben.labs.lab4.Coffee edu.ben.labs.lab4.CoffeeHouse Program Requirements: 1. Create a class called "Coffee" a. This class should have AT LEAST the following class variables: public static final int TALL1; public static final int GRANDE-2; public static final int VENTI3 private String name; private int size; private double cost; private int timeToMake; public Coffee (String name, int size, double cost, int timeToMake) b. Make sure to override both equals and toString in this class 2. Implement the following methods in a class called "CoffeeHouse" * Takes a coffee object and adds it to the next location in the "queue" eparam not null coffee object *Greturn true if coffee was added to queue, false if param c is null public boolean takeOrder(Coffee c) * "Serves" the order to the customer. This call will process the next order * in the queue, track any necessary metrics, and return the coffee order * Oreturn the next coffee order in the queue public Coffee serveOrder() * Determines the potential revenue based on the value of each coffee order in the queue. * @return revenue of all coffee orders currently in queue public double getPotentialRevenue() *Determines, at any given time, how long it will take to make all the *coffee orders currently in the queue. * @return time to make all coffee orders, e if none in queue public int timeToMakeCoffeeOrders() Gets the number of orders in the queue * Oreturn number of orders in the queue public int numOfOrders() * Returns an array containing the size counts of the coffee orders. *Location 0 is the count of the smallest size, location 1 is the count of * the medium size, and location 2 is the count of the largest size * Oreturn array containing the number of coffee orders by size public int[] getSizeCount() * Returns the next pending coffee order to be made without removing it from * the queue. A way to check what is coming without actually processing it * Oreturn a copy of the next coffee order object public Coffee viewNextOrder() * Returns the number of orders in the queue * Oreturn number of orders in queue public int getNumOrders () * Returns the total revenue processed to date. This does not include any * pending orders not yet served sitting in the queue. * Oreturn total revenue to this point public double getRevenue()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions