Difference between revisions of "CSC111 Homework 2 2014"

From dftwiki3
Jump to: navigation, search
Line 7: Line 7:
 
<br />
 
<br />
 
<br />
 
<br />
<onlydft>
+
 
=Problem #1=
 
=Problem #1=
  
Line 39: Line 39:
 
** a description of what the program computes.  What inputs it expects.  Whether it will run for all possible inputs or if there are known cases for which it might not run.
 
** a description of what the program computes.  What inputs it expects.  Whether it will run for all possible inputs or if there are known cases for which it might not run.
  
 +
<br />
 +
=Problem #2=
  
 
+
Stay tuned... not ready yet...
</onlydft>
+
<br />
 +
<center> <font size="+2">Page under construction!</font> <br \>[[File:UnderConstruction.jpg|300px]] </center>

Revision as of 12:55, 5 February 2014

--D. Thiebaut (talk) 19:41, 4 February 2014 (EST)


You must work in Pair-Programming mode on this homework. This homework is due on Thursday evening, 2/13/14 at midnight.



Problem #1

  • Call your program hw2a.py
  • Using the same approach as took in Lab 2, write a Python program that asks the user for an amount of money (dollars) that can include cents, and outputs a breakdown of this amount into bills and coins.
  • This time, however, you must use the string-formatting output provided by the % operator, as introduced in Section 2.5.3 of the textbook. You cannot use the concatenation method we used to print your output. You must use the %-operator.

Here is an example of the output your program you emulate. Note the the line between the bills and the coins.

Please enter the amount of money you want to withdraw:  200.56

+------------------------------------+
| Total amount withdrawn:  $ 200.56  |
|                                    |
| 10  $20-bill(s)                    |
|  0  $10-bill(s)                    |
|  0  $5-bill(s)                     |
|  0  $1-bill(s)                     |
|-------------------                 |
|  3  quarter(s)                     |
|  0  dime(s)                        |
|  0  nickel(s)                      |
|  1  cent(s)                        |    
+------------------------------------+
  • Make sure your program contains a header. The header is at the very top of the program, and is made of several comment lines.

In it you want to find the following information:

    • the name of the program
    • the name of the programmer(s), along with the 2-letter Id we'll use for this class.
    • the date the program was written
    • a description of what the program computes. What inputs it expects. Whether it will run for all possible inputs or if there are known cases for which it might not run.


Problem #2

Stay tuned... not ready yet...

Page under construction!
UnderConstruction.jpg