Question: Do this Assignment with Java. We are all probably familiar with the guessing game we play when waiting on line at the supermarket. You get
Do this Assignment with Java. We are all probably familiar with the guessing game we play when waiting on line at the supermarket. You get to the checkout area and look for the shortest line. Sometimes we even compare how many groceries the people on line in front of us have or watch the checkout person to see how quickly they are moving before deciding which line to pick. Then inevitably the one we pick turns out to be too slow and the customers on the other line who came after us are already done and in the parking lot before we start the checkout. A supermarket near my home has a much more efficient system. Everybody waits on one line and a store clerk directs customers to the next available checkout. There is typically only one person at each checkout, which ensures that everybody gets through in the order in which they arrived. Write a Java program called CheckOut, which simulates waiting on line at the supermarket. The program begins by having the user enter a list of customers. Customers have a name and an integer representing their number of groceries. Your program should allow the user to input any number of customers and build them into a single queue. Assume a checkout takes exactly second per grocery item to scan and bag. Your program will assign each customer to a checkout line in a way, which minimizes the total amount of time each customer spends waiting. It should output which checkout line each customer gets and their total waiting time from start to finish. For testing purposes, use the following list of customers and items: Doc items Happy items Sleepy items Bashful items Sneezy items Dopey items Grumpy item Extra Credit: Make one of the checkouts an express lane which only takes items or less. This will make Grumpy less grumpy since he is last in line.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
