Write java programs to simulate the management

Assignment Help Computer Engineering
Reference no: EM132076022

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.

Reference no: EM132076022

Questions Cloud

Prepare a schedule to allocate the purchase price : Prepare a schedule to allocate the purchase price to Carbury's assets and liabilities assuming Mendol paid $560,000 cash for the acquisition
How many gates would be required for an 8-bit adder : How many gates would be required for an 8-bit adder if it utilized these 4 bit adders in a carry select adder configuration?
New frontier of management organisation-control strategies : Organising and controlling are at the centre of management practice, but how these practices are undertaken within organisations varies significantly
Calculate the material purchase price variance : Standard unit price of materials £9.00, and Standard direct labour rate £28.00. Calculate the material purchase price variance
Write java programs to simulate the management : CS3810: Write java programs to simulate the management of customer queues in a grocery store. Assume that there are two cashier counters in the store.
Interest in the academic literature concerning leadership : Identify one major theme or topic of interest in the academic literature concerning leadership and teams and provide a clear description of the theme or topic
What down payment will she need : Sara wants to buy a house. The house she wants is listed for $600,000, and she wants to avoid PMI insurance. She can get a fixed rate mortgage at 3.25%.
What is the total profit from all sales : Sales without the special order are 50,000 units. What is the total profit from all sales, assuming the special order is accepted
Individual motivation journal : You are required to submit a written reflective journal, in chronological format over a one week period that you have recorded.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd