The project I've created is a vending machine. It holds sodas and snacks(potato chips,cookies, and chocolates).
In order to get/buy a product from the machine, the customer should choose first from the list of products by "clicking" them.
Once the user "clicked" a particular product, a message will be displayed if he/she really like to buy that specific item.
If the user agreed, then another message will pop which tells how much its cost. After choosing an item, the user should
select which coin will he/she drop into the machine. It's either a five-peso coin or a ten-peso coin. If a coin is already
selected, then he/she should press the button "DROP COIN" to drop the coin into the machine. As the user drops the coin,
the total amount of the coins dropped increases until it reaches the total price of the item. If the total price is reached or if the
total amount of the coins dropped is greater than the total price, the product he/she had chosen will be released by the machine.
To get the product from the machine, just press the button "GET PRODUCT". Should the user choose to buy again, he will only repeat the process.
The user is allowed to buy only a piece of a product at a time (one quantity of a chosen item per transaction). In case
the customer dropped a larger amount, larger than the total price, this machine would not give his/her money back. This mahcine will not return any change.
If the user finished a transaction or if he/she wants to exit, just press the "FINISH" button.
THE USE CASES
Use Case Specification: STARTUP
Brief Description: Executes the program. Display the Graphical User Interface (GUI).
Post Condition: The GUI is displayed.
Normal Flow: Loads the image, the components of JFrame and initializes the variables.
Alternative Flow: If the image for the machine is not found, there will displayed image, but the components of JFrame are present. In case the fail to create the JFrame, nothing will be displayed.
Use Case Specification:
Brief Description: Allows the user to choose the item he/she wants. (choose from the JList)
Precondition: The GUI/JList must be displayed. (startup)
Post Condition: The total price that the user will pay will be equal to the price of the item he/she chose.
Normal flow: If the product is selected, shows messages for the user. Sets the total price equal to the price of the item.
Alternative flow: If the user fail to choose an item, the user should not proceed to dropping of coins.
Specification: SELECT COIN
Brief Description: Allows the user to select the coin he/wants to drop onto the machine. It's either a five-peso coin or a ten-peso coin.
Precondition: Choose Product (the user must have already chosen the item)
Post Condition: The selected coin is either 5-peso coin or 10-peso coin.
Normal Flow: If coin is selected, you're allowed to press the "DROP COIN."
Alternative Flow: If no coin is selected, the user should not drop the coin. He should select a coin, otherwise.
Use Case Specification:
Brief Description: Drops the coin into the machine. Updates the total amount of dropped coins.
Precondition: Select Coin (the user must have already selected a coin)
Post Condition: Release the item, if the total amount of dropped coins is greater than or equal to total price. Otherwise, the user keep on selecting and dropping a coin.
Normal Flow: If "DROP COIN" button is pressed, loads the image that drops the coin, then display it. Shows message "Drop P5 coin?" or "Drop P10 coin?" If the total amount of dropped coins is greater than or equal the total price, an image which release the item selected, will be loaded and displayed. Otherwise, no item will be released.
Alternative Flow: If "DROP COIN" button is not clicked, you will not see the image that drop the coins, you will not be able to pay for the item, you will not be able to get the item. So, you should choose a coin first, then drop it.
Specification: GET PRODUCT
Brief Description: Allows the user to get the product she bought.
Precondition: Drop Coin (The product is released by the machine.)
Post Condition: The released item will be gone.
Normal Flow: If "GET PRODUCT" button is clicked, the original image of the vending machine will be loaded and displayed. (the released item will be gone.)
Alternative Flow: If "GET PRODUCT" button is not pressed, the item will remain in the "area-of-the-released-product" of the vending machine.
Brief Description: Terminates the program.
Post Condition: GUI will be gone. Program terminates.
Normal Flow: If "EXIT" button is clicked, the window for the GUI will be closed.
Alternative Flow: If "EXIT" button is not pressed, the program will not terminate and remain its state.
|The program used: