CSC111 Homework 3 2015
--D. Thiebaut (talk) 10:42, 9 February 2015 (EST)
Contents
Problem 1: Teller Machine: Version 1
Rewrite the program we saw in class that asks the user for some amount of dollars, and outputs the number of $20, $10, $5 and $1 that needs to be distributed. Call your program hw3.py.
In this version, we assume that the user is well behaved and will enter only valid integer numbers.
Make sure you test your program well, so that it works well with particular dollar values, such as 0, 1, 5, 10, and 20.
Submit your program to the Moodle HW 3 PB 1 section.
Problem 2: Teller Machine: User sometimes inputs floats
This version of your program should be robust enough to work well, even when the user enters a number of the form 10.25. In such a case your program will only treat the integer part of the sum entered by the user, and will discard the decimal digits. So 10.25 will be treated as 10.
Call your program hw3.py.
Submit your program to the Moocle HW 3 PB 2 section.
Problem 3: Teller Machine: User inputs sometimes inputs negative numbers
Make your program more robust so that if the user enters a minus sign in front of the number, by mistake, your program will discard it. In other words, if the user enters -30.50, your program will treat this number as 30. If the user enters -10, the program will treat it as 10.
Submit your program hw3.py program to the Moodle HW 3 PB 3 section.
Problem 4: Teller Machine with $50-bills
Your new program, also called hw3.py, will now be able to accept negative numbers or floats as input, and will also include a number of $50-bills.
Submit your program, called hw3.py, to the Moodle HW 3 PB 4 section.
Problem 5: Teller Machines giving out $5 as smallest denomination
This time your program will give out $50, $20, $10, and $5 bills, but no $1. If the user enters an amount that is not a multiple of 5, the program rounds up to the smallest multiple of 5. For example, if the use enters 34, your program will give out 1 $20, and 1 $10 bill. If the user enters 11, as the amount to withdraw, the program will output 1 $10-bill.
Submit your new version of hw3.py to the Moodle HW 3 PB 5 section.
=Problem 6: Teller Machine with pennies.