Exam 3- 2011

Read the instructions carefully before you start

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: purse. If the number of coins of a specific type (e.g. pennies) to remove is greater than the amount that was in the purse, then pay out all of the coins of that type and set the new amount to 0. • Returns the dollar amount that was actually paid. CS 115 Exam 3, Fall 2011 Page 8 of 11 CS 115 Exam 3, Fall 2011 Page 9 of 11 Problem 5: 20 points. For this problem, you must write a complete program. That includes a docstring, a def main(), any necessary library imports, etc. You can assume that the CoinPurse class from Problem 4 has already been correctly defined. Read the instructions carefully before you start coding! Your program should contain the following: 1. A function called MakePurse to do the following: o Ask the user to enter 3 integers (pennies, dimes, and quarters) o Print an error message and exit the program if any of the user’s inputs could not be converted to a valid integer. o Otherwise, create a...
View Full Document

This note was uploaded on 02/08/2014 for the course CS 115 taught by Professor Staff during the Fall '08 term at Sonoma.

Ask a homework question - tutors are online