Write some Software for Vending Machine!
- Status: Closed
- Hadiah: $11
- Penyertaan diterima: 4
- Pemenang: riharsha
You are asked to design and implement a Java program using GUI interface to simulate a vending machine. The program will work with item names, their image, their prices, and the current number available in the machine. The machine should display 9 different items. When the application starts, the vending machine will have 10 of each type of goods or items. Each time the user selects an item, the application should subtract 1 from the quantity of the selected drink. It should also update and display the total amount of sales.
In this project, your program must read in and store the machine data in an array of items where each time the program runs, it will enter a loop that performs the following steps: a list of items and their prices is displayed on the screen. The user is then allowed to either quit the program or pick an item from the machine. If the user selects an item, the program will notify the user that an amount must be entered for payment. The program will then display the amount of change that would be returned and subtract one from the number of items left in the machine for that item. If the user selects an item that is sold out, a message to that effect will be displayed. The loop then repeats. When the user chooses to quit the program, the program must display the total amount of sales the machine earned during the current run. Then, print out a summary table of the machine's final state, which includes the drink names, prices, and cans available in the machine at that point.
You are simulating the interaction between a person using a vending machine and if you were buying an item, what would you need to see displayed to understand what was happening at each step? What would you like to see to make the machine user-friendly? Part of your grade on this programming project will be determined by how well you utilize methods and parameters appropriately.