Question: Write a program called vending.py that simulates a vending machine with respect to calculating change based on the amount paid. The program will accept
Write a program called vending.py that simulates a vending machine with respect to calculating change based on the amount paid. The program will accept as input the cost of the item purchased, and will prompt the user to add money until the cost is met/exceeded. It will then calculate and print the change. Assume that payments and change are given in R50, R20, R10, RS, R2, and R1 amounts. Sample 10: Enter the cost (in Rand): 21 Deposit a coin or note (in Rand): 10 Deposit a coin or note (in Rand): 20 Your change is: 1 x R5 2 x R2 NOTE: The program will calculate the minimum number of coins to give while making change.
Step by Step Solution
3.49 Rating (156 Votes )
There are 3 Steps involved in it
Getting the cost of the item from the user cost intinputEnter the costin Ra... View full answer
Get step-by-step solutions from verified subject matter experts
