Objective: Build a Python program that simulates the operation of a coffee machine simulation. This project will help you understand the basics of Python programming and how to use PyCharm for development.


  1. User Interaction:
    • The program should start by asking the user, “What would you like? (espresso/latte/cappuccino):”
    • It should repeatedly prompt the user until they choose to turn off the coffee machine.
  2. Turn Off the Machine:
    • Users and maintainers can turn off the coffee machine by entering “off” as a command.
  3. Report:
    • Users can request a report that displays the current resource levels of the coffee machine. For example:makefileCopy codeWater: 100ml Milk: 50ml Coffee: 76g Money: $2.5
  4. Resource Availability:
    • The program should check if there are enough resources (water, milk, coffee) to make the selected drink.
    • If resources are insufficient, the program should print an appropriate message (e.g., “Sorry, not enough water”).
  5. Processing Coins:
    • When the user selects a drink, the program should prompt them to insert coins.
    • The program should accept quarters ($0.25), dimes ($0.10), nickels ($0.05), and pennies ($0.01).
    • Calculate the total monetary value of the coins inserted.
  6. Transaction Handling:
    • Check if the user has inserted enough money to purchase the selected drink.
    • If they have, calculate the change if needed, add the money to the machine, and make the drink.
    • If they haven’t inserted enough money, refund the money and display an appropriate message.
  7. Making Coffee:
    • If the transaction is successful and resources are available, make the selected drink by deducting the required resources.
    • Display a message like “Here is your latte. Enjoy!” if the user ordered a latte, for example.

Development Environment:



Day 15 : Solution Coffee Machine Simulation

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *