Question
Design a framework for simulating the processing of customers at a bank or supermarket. Such a simulation is based on the notion of events. Each
Design a framework for simulating the processing of customers at a bank or supermarket. Such a simulation is based on the notion of events. Each event has a time stamp. Events are placed in an event queue. Whenever one event has finished processing, the event with the earliest time stamp is removed from the event queue. That time stamp becomes the current system time. The event is processed, and the cycle repeats. There are different kinds of events. Arrival events cause customers to arrive at the bank. A stream of them needs to be generated to ensure the continued arrival of customers, with somewhat random times between arrivals. This is typically done by seeding the event queue with one arrival event, and having the processing method schedule the next arrival event. Whenever a teller is done processing a customer, the teller obtains the next waiting customer and schedules a "done processing" event, some random time away from the current time. In the framework, supply an abstract event class and the event processing mechanism. Then supply two applications that use the framework: a bank with a number of tellers and a single queue of waiting customers, and a supermarket with a number of cashiers and one queue per cashier.
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