Description: Description: Description: Description: Description: Description: Description: Description: Breaking News! Click here for details.

 CSC 131 - Introduction to Computer Science

Homework 3 – Due Thursday, Sep. 7, 11:59pm

Submitted on Blackboard (learn.uncw.edu)

Three programs based on material from Chapters 3.

 

Program 1: Student Status

Write a Python program, StudentStatus.py, in which a student enters the number of college credits earned.  If the number of credits is greater than 90, ‘Senior Status’ is displayed; if greater than 60, ‘Junior Status’ is displayed, if greater than 30, ‘Sophomore Status’ is displayed; else, ‘Freshman Status’ is displayed.

 

 

Program 2: Calculating Change

[Warning: This is a long program. There’s a lot of similar code that gets repeated for each denomination.]  Write a Python program, ComputeChange.py, that asks the user for the purchase price of some item.  Then it asks them for the amount tendered by a customer.   The program should calculate the change and show how the change may be given in a combination of $20 bills, $10 bills, $5 bills, $1 bills, quarters, dimes, nickels, and pennies.  If the change does not require any of a certain denomination, then don’t print it out.   If it only requires one of some denomination, like nickels, print out “1 nickel” rather than “1 nickels”.  Here are a few examples:

 

 

Enter the purchase price: 9.99

Enter the amount tendered: 20

 

Purchase price:          $   9.99

Amount Tendered:         $  20.00

Change:                 $  10.01

 

1 ten dollar bill

1 penny

 

Here’s another run:

 

Enter the purchase price: 12.48

Enter the amount tendered: 100.00

 

Purchase price:          $  12.48

Amount Tendered:         $ 100.00

Change:                 $  87.52

 

4 twenty dollar bills

1 five dollar bill

2 one dollar bills

2 quarters

2 pennies

 

Here’s another run:

 

Enter the purchase price: 0.01

Enter the amount tendered: 20

 

Purchase price:          $   0.01

Amount Tendered:         $  20.00

Change:                 $  19.99

 

1 ten dollar bill

1 five dollar bill

4 one dollar bills

3 quarters

2 dimes

4 pennies