Restaurant Simulator is implemented using BlockingQueue. The goal of simulator is to reach the peak operating capacity of the restaurant. It hires waiters when it has less then optimal number of waiters working to server the customers. It also fires them, should the number of waiters reach more then the optimal number of waiters for the current utilization of restaurant.
Restaurant Simulator can be shutdown by pressing Ctrl ^C in Windows and most Unix Operating Systems. At shutdown, it displays statistics like:
*********************************************
Restaurant Statistics
*********************************************
Restaurant has been running for : 14 seconds.
Peak capacity: 500.
Current number of customers: 45.
Current number of waiters: 4.
Current optimal number of waiters: 5.
Number of customers entertained: 105.
Number of orders processed: 105.
Number of waiters hired: 28.
Number of waiters fired: 24.
Amount of money processed: $429.44.
*********************************************
If you would like to run it, you may do so by downloading it from here.
I am looking forward to implementing the same using C# to learn how multi-threading can be implemented in C#.
