Due Date: midnight, Friday, 9 November.

This assignment focuses on decisions from Chapter 7.

Submit the following programs via Blackboard:

  1. (From Chapter 7, #3, Page 230) A certain CS professor gives 100-point exams that graded on the scale:

    • A: 90-100
    • B: 80-89
    • C: 70-79
    • D: 60-69
    • F: 0-59

    Write a program that accepts an exam score as input and uses a decision structure to calculate the corresponding letter grade.

  2. Write a function that takes as a parameter the zone and returns the Long Island Railroad fare.

    • If the zone is 2 or smaller, the fare is 7.25. If the zone is 3, the fare is 8.75.
    • If the zone is greater than or equal to 4 and less than or equal to 6, the fare is 10.00.
    • If the zone is greater than or equal to 7 and less than or equal to 8, the fare is 11.50.
    • If the zone is 9, the fare is 13.50. If the zone is greater than or equal to 10, the fare is 20.00.

  3. Write a program that asks a user to enter a list of clothing items purchased. Your program should then calculate their total bill with tax. In New York City, the tax on clothing items that priced $110 or less is 0%. The tax on clothing items priced more than $110 is 8.5%.

    Here is a sample run of the program:

    		Please enter clothing prices, separated by commas:  100, 9.99, 200, 159.99
    		Your receipt:
    		    200.00  T
    		    159.99  T
    	 	     30.60  Tax
    		    500.58  Total 
    (The `T' indicates which items are taxed. To make the receipt look nice, you can use format() and rjust() functions.

  4. Modify the decodeMessage.py program from Lab 5 which encodes messages with lower case letters to one that can also encode messages with upper case letters and numbers.

    For example,

    		This program decodes a textual message
    		Each character is replaced with the character 2 places ahead in the alphabet.
    		The characters "'", ".", "(", ")", and " " are not decoded.
    		Please enter the message to decode: 250 Bedford Park Blvd W, 10468
    		The decoded message is: 472 Dgfhqtf Rctm Dnxf Y, 32680

    (Hint: try the original program on the message above. What are the differences in the encoded messages it produces and the output above? Remember that ord("a") is different from ord("A"))

  5. Write a graphics program that changes colors depending where the user clicks on the window. If the user clicks on the left side, the window should turn green. If the user clicks on the right side, the window should turn red. Your program should allow the user to click 5 times before ending the program.
For more information on using Blackboard, see the first lab.

General Notes