You need help with the following programming assignment
Assignment : Data Structures and Algorithms
Problem description:
Write java programs to simulate the management of customer queues in a grocery store. Assume that there are two cashier counters in the store.
The customers may choose any counter to checkout. Assume a store manager who is in charge of balancing the length of the queues for efficient services. Display the sale's report when the store closes.
Implementation:
Create a Customer class with the following variables and methods:
Variables - Customer ID (may use static var, or set a random number), # of items in the cart (int, a random number between 1 to 20), the total price of all items in the cart (double, # of items * 10)
2) Methods - set/get, toString()
Create a Cashier class. This class represents a customer queue for a cashier. Each element in a queue is an object of Customer class. There are following methods in the class to allow us to simulate and manipulate the queues:
void addToQueue(Customer c) - adds one customer to the end of the queue
Customer endService() - Adds the subtotal of the items from one customer and removes the customer from the front of the queue.
Int getLength() - returns the length of a queue
Void clone(Customer[] customerQueue) - copy the contents in customerQueue to this customer queue
boolean isEmpty() - returns true if the queue is empty
Boolean isFull() - returns true if the queue is full
String toString() - returns a string containing the detail info of all customers in the queue
Design constructors in each object class.
Create an app class to manipulate the queues. Provide the following operations (the main menu):
Customer checkout (a customer is able to choose a cashier queue, do not do auto assigning)
2) Cashier 1 serves a customer
3) Cashier 2 serves a customer
Report queue status (display the detail info of two queues including the number of customers and customer ID, # of items in the cart and the price for every customer in each queue)
Manager adjusts queues (adjusts the length of two queues to let them to be equal or have one difference in the # of customers)
Close a cashier (merge two queues, not concatenate one queue to another)
Closes store (two cashiers serve all customers in the queues. The total sale of the store should be reported.)
Methods:
void adjustQueues () - adjust two queues by comparing the current length of two queues and do the adjustment
boolean mergeQueues (Cashier cashier1, Cashier cashier2) - merge two queues into one queue under cashier1. After merge, cashier1 has a longer queue and cashier2 has no customers.
Return: true - merged; false - the total number of customers exceeds one queue capacity
You may create other help methods as you need
At the beginning of the program, ask user to type in the queue capacity. Bother queues have the same capacity. This number is used to create the queues in two cashiers. The application class ends only when the user selects item 7, Close store. For all other selections, the program should continue run and display the menu to the user.