This project emulates a vending machine using Python, implementing functions and matrix concepts to manage the products and transactions. This project was created for the Algorithmic Logic course during the first semester of the Bachelor's in Computer Science at PUCPR. It leverages matrix operations and uses methods within classes to manage the vending machine's functionalities.
-
Purchase a beverage by inserting Brazilian currency notes and coins.
-
Default available beverages:
ID Product Price Stock 1 Coca-cola 3.75 2 2 Pepsi 3.67 5 3 Monster 9.96 1 4 Coffee 1.25 100 5 Redbull 13.99 2 -
Validates the availability of the chosen beverage and ensures payment is enough.
-
Calculates and returns the change using the fewest possible notes and coins.
-
Dynamically updates the stock after each purchase.
- The machine awaits the customer to select a beverage by entering its code.
- The customer is prompted to insert money until it matches or exceeds the beverage price.
- The machine will calculate and return the change, specifying the notes and coins given.
- If the input is
0
, the customer can return to the menu.
- To access Admin Mode, enter the password
17102004
. - Admin Mode allows the addition, removal, and updating of products dynamically.
- The program also considers the stock of available notes and coins to manage change. If there is insufficient change, the purchase is canceled.
- Python 3.x
- Clone the repository:
git clone https://github.com/tuchanski/vending-machine.git
- Navigate to the project directory and run the Python file:
cd vending-machine python main.py