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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.