You are to design a Java application to control the operations of at least 2 snacks and drinks vending machines. Each vending machine has at least 10 dispensers and each dispenser holds at least 20 of one kind of drinks or snacks for purchase. Each dispenser should also display the price, name, and nutrition information for the snack or drink it holds. You may display whatever nutrition information you prefer. Just make it interesting and appealing to clients. Each vending machine must also display a menu of drinks and snacks available on each dispenser for clients to choose from.
A client must first enter enough money to make a purchase. If the client's choice has run out or the entered money is not enough, the purchase won't continue. Design an exception and its handler to handle the situation such as error message, money return, or asking for another choice or more money amount. Print a receipt after each purchase including name and price of the purchased item, entered money amount and change.
Use a random number generator to determine client arrival and which vending machine the client is using. Also use a random number generator to decide when the machines will be turned off and program execution terminates. If you desire, you may use a real time clock or a loop to determine when to turn off the vending machines. Before the program execution terminates, save the inventory of the vending machines in a file for next program execution. Also save the sales total and the subtotal and number of items sold on each dispenser in a separated file.
At least 4 Java classes are required: VendingMachine, Dispenser, FoodInformation (Drink or Snack), and main class.