Final Project: Java Simulate a vending machine
Operation
This is a java application that simulates a vending machine that dispenses soft drinks.
The Quarter button deposits $0.25.
The Dollar button deposits $1.00.
The label indicates the current credit.
The Refund button refunds the customer’s credit.
The slot buttons display the name of the product currently loaded in one of the vending machine’s six slots. The example above shows that the vending machine is loaded with Pepsi, Diet Pepsi, Mountain Dew, Dr. Pepper, Root Beer, and Water.
When the program starts, the six slot buttons are disabled. The program enables these buttons when the user has a credit of at least $1.00 (the cost of one item).
If the user clicks one of the slot buttons, the program displays a dialog box that tells the user to enjoy the beverage. For example, “Enjoy your Diet Pepsi.”
If the user clicks Refund, the program displays a dialog box that asks the user to take his or her change. For example, “Please take your change of $1.25.”
Specifications
You may design any classes you wish to use for this application. For example, you may want to create a class that defines a vending machine or a beverage.
Each slot in the vending machine can hold up to 10 bottles. The application should keep track of how many bottles are available in each slot and display a dialog box with the message “Out of Stock” if the user selects a beverage that’s out of stock.
Disable the beverage’s button if the beverage is out of stock
Create a report button on this page that can be clicked that will show the current sales of sodas (Soda name, Qty & Revenue). The “report” should be implemented by using a second jframe (Java) or Acivity(Android) and have a button to return the user to the first form.
All data should be stored permanently such that if the application is stop/closed and re-opened the “Soda Machine” will still have the correct inventory.
•
•