Coffee Machine Program Requirements
dispensed. The prompt should show again to serve the next customer.
the machine. Your code should end execution when this happens.
the current resource values. e.g. Water: 100ml Milk: 50ml Coffee: 76g Money: $2.5
resources to make that drink.
not continue to make the drink but print: “Sorry there is not enough water.”
prompt the user to insert coins.
pennies = 0.25 + 0.1 x 2 + 0.05 + 0.01 x 2 = $0.52
a. Check that the user has inserted enough money to purchase the drink they selected. E.g Latte cost $2.50, but they only inserted $0.52 then after counting the coins the program should say “Sorry that's not enough money. Money refunded.”.
machine as the profit and this will be reflected the next time “report” is triggered. E.g. Water: 100ml Milk: 50ml Coffee: 76g Money: $2.5
E.g. “Here is $2.45 dollars in change.” The change should be rounded to 2 decimal places.
user selected, then the ingredients to make the drink should be deducted from the coffee machine resources. E.g. report before purchasing latte: Water: 300ml Milk: 200ml Coffee: 100g Money: $0 Report after purchasing latte: Water: 100ml Milk: 50ml Coffee: 76g Money: $2.5
latte was their choice of drink.