Starting from:

$30

IT210- Fundamentals of Programming Lab 3 Solved

This program requires you to write Python code that implements problem Business P3.34 in your text on page 148. That problem is restated here:

A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you will get a coupon worth eight percent of that amount. The following table shows the percent used to calculate the coupon awarded for different amounts spent. Write a program that calculates and prints the value of the coupon a person can receive based on groceries purchased.

Money Spent
Coupon Percentage
Less than $10
No coupon
From $10 to $60
8%
More than $60 to $150
 
More than 150 to $210
12%
More than $210
14%
Implementation requirements:

     Appropriately comment your code and include your name as a comment on the first line.

     The input should expect a floating point value for cost of groceries

       The value of the coupon must be printed with 2 decimal places and look like the examples below.

Sample runs (each of these is a separate run, no looping from chapter 4 allowed):

Please enter the cost of your groceries: 8.58 You do not qualify for a discount coupon.
Please enter the cost of your groceries: 59.99

You win a discount coupon of $4.80. (8% of your purchase)
Please enter the cost of your groceries: 60

You win a discount coupon of $6.00. (10% of your purchase)
Please enter the cost of your groceries: 209.95

You win a discount coupon of $25.19. (12% of your purchase)
Please enter the cost of your groceries: 375.40

You win a discount coupon of $52.56. (14% of your purchase)
Submit a copy of the lab to the Lab 3 D2L dropbox not later than 11:59 pm Thursday evening. Name your file Lab03.py.

More products