Assigned: Friday, January 24
Due: Thursday, January 30, 2014 by 11:55pm
Description
Vending machines on campus sell lots of goodies for nominal fees. Assume that all snacks cost between 25 cents and 1 dollar, and prices are always multiples of 5. A user can only buy 1 item at a time, and the machine only accepts a single dollar bill for each transaction. You need to determine the correct change to be dispensed. You'll need to prompt the buyer for the price of their item and then determine their change in terms of # of quarters, # of dimes and # of nickels. Very few people prefer to get all nickels as their change, so be sure to always calculate quarters, then dimes, then nickels.
You should also make sure that your output is grammatically correct, such that if only 1 nickel is owed, then you output nickel rather than nickels. This program is meant to test your understanding of input statements, output statements, if-else statements, and mathematical calculations. It is not meant to test your understanding of functions; there will be other programs later to test your function skills.
Write a Python program that includes a main function. You are not required to write any other functions, but you must define a main function and call it. Your main function should:
Some examples of possible dialog with the user might be (user input is in italics):
Test 1
Enter price of item (from 25 cents to $1, in 5-cent increments): 45
You bought an item for 45 cents and gave me a dollar.
Your change is 2 quarters, 0 dimes, and 1 nickel.
Test 2
Enter price of item (from 25 cents to $1, in 5-cent increments): 65Your code does not need to follow this exact script, but all the mentioned functionality should work as shown.
You bought an item for 65 cents and gave me a dollar.
Your change is 1 quarter, 1 dime, and 0 nickels.
HINT: I recommend having the user enter an integer for the amount of change, not a floating point number, e.g. 65 not 0.65. (This will prevent weird floating point errors from happening.)
Get your program to output the correct # of quarters, dimes and nickels first before worrying about proper grammar.
What to Do
Requirements
When I examine your program, it must satisfy the following requirements. The maximum point value for each requirement is shown in brackets.