Question: Programming Assignment 2 Part 1 Write a program that prompts and reads in two inputs, the unit price of an item and the quantity of
Programming Assignment 2
Part 1 Write a program that prompts and reads in two inputs, the unit price of an item and the quantity of items purchased. Compute the order cost as unit price times quantity and deduct a discount of 5% on orders of 10 or more, and 10% on orders of 100 or more. Print the unit cost, total order cost and discount amount properly labeled.
Part 2 Put the discount program in a while loop that after running the program the 1st time, asks the user if they want to run it again. If the user answers yes, run it again, other wise exit. You can accept a user response of Y for yes, and assume anything else means no.
I got the first part just having so much trouble with second part(putting discount program in while loop) my program code is below
price=float(input("enter the unit price of an item:"))
quantity=float(input("enter the number of items:"))
unitCost=price*quantity
discount=0
if quantity>=10 and quantity <100:
discount=5
elif quantity>=100:
discount=10
discountAmount=(unitCost*discount)/100
totalCost=unitCost-discountAmount
print("Unit Cost:",unitCost)
print("Total Cost:",totalCost)
print("Discount:",discountAmount)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
