This is a simple Python project that simulates a coffee vending machine.
Users can choose from different types of coffee, insert coins to pay, and receive their drinks if enough resources and payment are available.
- Menu options: Latte, Espresso, Cappuccino
- Coin collection and payment processing
- Resource checking (water, milk, coffee)
- Transaction management (gives change if needed)
- Report generation for current resources and earnings
- Machine shutdown option (
offcommand)
- The machine asks, "What would you like? (latte/espresso/cappuccino)".
- If enough ingredients are available:
- It asks how many coins the user is inserting (5, 10, 20 coins).
- It checks if the inserted money is enough.
- If yes, it deducts ingredients, gives change if needed, and serves coffee.
- If not, it refunds the money.
- Special Commands:
- Type
reportto see the current resources and money. - Type
offto turn off the machine.
- Type
- Python 3
(No external libraries are required.)
- Save the code in a Python file, e.g.,
CoffeeMachine.py. - Open your terminal or command prompt.
- Navigate to the folder containing
CoffeeMachine.py. - Run the script:
python CoffeeMachine.pyWhat would you like? (latte/espresso/cappuccino): latte
Please insert coins
How many 5 coins? 4
How many 10 coins? 5
How many 20 coins? 2
Here is your change 30.
Here is your latte ☕. Enjoy!
Thank you for using the coffee machine!
CoffeeMachine.py # Main program file
README.md # Project description and instructions
- Add more drink options.
- Handle invalid inputs more smoothly.
- Introduce different coin denominations.
- Add an admin login to refill resources.