A supermarket manager would like to investigate if the queueing time of the customers at the counters can be minimized so that customer satisfaction can be increased.

computer science

Description

A supermarket manager would like to investigate if the queueing time of the customers at the counters can be minimized so that customer satisfaction can be increased. There are at most two counters and ten customers. For simplicity, the processing time of each supermarket item at the counters is assumed to be equal to 1 unit of time (e.g. if there are 5 items, the processing time is 5) and all the customers are arriving at the same time (i.e., at time = 0). A class Supermarket is designed to implement the application. Another class Customer models the customers. It has an instance variable items which stores the number of items to be bought by the customer. The variable custQueue of Supermarket is an array which containes references to instances of Customer in their order of arrival. The variable items of Customer has been initialized. The accessor methods of items (getItems(), setItems()) are available.  (a) If only one counter is available: (i) write a method storeQueueTime(Customer[] custQueue) to calculate the queueing time of each customer and store it in the instance variable queueTime of each instance of Customer (the queueing time is the time needed to wait before the items of the customer are processed.). You can assume the accessor methods of queueTime (getQueueTime(), setQueueTime()) are available.
public void storeQueueTime(Customer[] custQueue) {


Related Questions in computer science category