100% found this document useful (1 vote)
284 views

Coffee Machine Classes Documentation

The document describes four classes used to model a coffee shop management system: 1. MenuItem class represents individual drink items with attributes like name, cost, and ingredients. 2. Menu class handles drink menus with methods like getting all item names or finding a drink by name. 3. CoffeeMaker class tracks resources like water and milk, checks if ingredients are sufficient for a drink, and makes coffee by deducting ingredients. 4. MoneyMachine class tracks profit and handles payments, printing current profit and accepting or declining payments based on their cost.

Uploaded by

Utkarsh Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
284 views

Coffee Machine Classes Documentation

The document describes four classes used to model a coffee shop management system: 1. MenuItem class represents individual drink items with attributes like name, cost, and ingredients. 2. Menu class handles drink menus with methods like getting all item names or finding a drink by name. 3. CoffeeMaker class tracks resources like water and milk, checks if ingredients are sufficient for a drink, and makes coffee by deducting ingredients. 4. MoneyMachine class tracks profit and handles payments, printing current profit and accepting or declining payments based on their cost.

Uploaded by

Utkarsh Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MenuItem Class

Attributes:

- name
(str) The name of the drink.
e.g. “latte”

- cost
(float) The price of the drink.
e.g 1.5

- ingredients
(dictionary) The ingredients and amounts required to make the drink.
e.g. {“water”: 100, “coffee”: 16}

Menu Class

Methods:

- get_items()
Returns all the names of the available menu items as a concatenated string.
e.g. “latte/espresso/cappuccino”

- find_drink(order_name)
Parameter order_name: (str) The name of the drinks order.
Searches the menu for a particular drink by name. Returns a MenuItem object if it exists,
otherwise returns None.

CoffeeMaker Class

Methods:

- report()
Prints a report of all resources.
e.g.
Water: 300ml
Milk: 200ml
Coffee: 100g

- is_resource_sufficient(drink)
Parameter drink: (MenuItem) The MenuItem object to make.
Returns True when the drink order can be made, False if ingredients are insufficient.
e.g.
True

- make_coffee(order)
Parameter order: (MenuItem) The MenuItem object to make.
Deducts the required ingredients from the resources.

MoneyMachine Class

Methods:

- report()
Prints the current profit
e.g.
Money: $0

- make_payment(cost)
Parameter cost: (float) The cost of the drink.
Returns True when payment is accepted, or False if insufficient.
e.g. False

You might also like