Question
Create a java project for how many cashiers a store will need. You need to have the following classes: Customer, Cashier, MainSimulation, and any other
Create a java project for how many cashiers a store will need. You need to have the following classes: Customer, Cashier, MainSimulation, and any other necessary classes like Event. Customer information like the number of products, arrive time, leave time, etc will be in Customer class, and Cashier information like waiting line, cashier busy time, etc should be in Cashier class.
Item for shopping: Assume that each item consumes certain time in the cashier.
Customer: Each customer has an arrival time to cashier Each customer has a number of items
Cashier: Cashiers have a waiting line Cashier serves each customer according to First Come First Serve.
Random generator: Random generator generates customer with arrive time to cashier sections and the number of items for each customer.
Event Simulator: Event can be leaving or arriving. If it is arriving event, new customer arrives the cashier. If it is leaving, the cashier finishes tasks and ready to take a new customer.
Your simulation must run until virtually finish 1 hour of operation.
For this type of simulation, you need to consider several cases: Case 1: If there are multiple empty cashiers, the new arrived customer can select one of them to get service. Case 2: If all cashiers are busy, the new arrived customer selects the waiting line which has the lowest number of products in the queue (total products for multiple customers, not the number of customer). Case 3: If there are 10 customers in the waiting lines for each cashier, the new arrived customer does not select any cashiers and leaves without buying the items.
You need to get six inputs from the user. Maximum number of the items a customer can have, minimum number of the items a customer can have, maximum number of customers can arrive to cashiers in 10 minutes, minimum number of customers can arrive to cashiers in 10 minutes, the number of cashiers, and time for scanning and handling a product in terms of seconds (e.g. : 100, 10, 50, 10, 5, 3). Please pay attention bigger and smaller values if the user enter correctly.
Calculation of the cashiers average working time: If there are two cashiers, and one of them was busy 20 minutes and the other one was busy 10 minutes in 60 minutes, The average is (10 + 20)/(60+60) = 1/4.
. Calculation of the average waiting time for the customer: If three customers got services from a cashier (assume there is only one cashier) and their arrived time to cashier waiting line as 0, 5, and 7, respectively. The first customer does not wait in the waiting line, so the first customer waiting time is 0, the second customer needs to wait for the first one, so assume the first one service time is 10 minutes. Therefore, the second customer waits 10 - 5 because the second customer arrives, when 5 minutes passes from the first customer service time. Third one must wait 3 minutes for first one and plus second customers service time. So the third one must wait 3 + the second customer service time (assume the second customers service time = 25). Therefore, average waiting time for the three customers is (0 + 5 + 28) / 3 = 11.
You are free to use Java Queue with LinkedList and ArrayList libraries, but nothing else.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started