Question: Write a program that computes how much a customer has to pay after purchasing two items. The price is calculated according to the following rules:

Write a program that computes how much a customer has to pay after purchasing two items. The price is calculated according to the following rules:

Buy one get one half off promotion: the lower price item is half price.

If the customer is club card member, additional 10% off.

Tax is added.

Inputs to the program include:

Two items prices

Have club card or not (User enters Y or y for yes; N or n for no)

Tax rate (User enters the percentage as a number; for example they enter 8.25 if the tax

rate is 8.25%)

For example, an execution could look like this: Enter price of first item: 10 Enter price of second item: 20 Does customer have a club card? (Y/N): Y

Enter tax rate, e.g. 5.5 for 5.5% tax: 8.25 Base price = 30.0 Price after discounts = 22.5 Total price = 24.36

And this is what i wrote:

first=int(input("Enter price of first item:")) second=int(input("Enter price of second item:")) club=input("Does customer have a club card?(Y/N):") tax=float(input("Enter tax rate, e.g. 5.5 for 5.5% tax:")) print("Base price="+str(first+second)) if first >= second and club == "Y": priceafterd=print("Price after discount="+str((first+0.5*second)*0.9)) print("Total price="+str(priceafterd*(1+tax/100))) elif second >= first and club == "Y": priceafterd=print("Price after discount="+str((second+0.5*first)*0.9)) print("Total price="+str(priceafterd*(1+tax/100))) elif first >= second and club == "N": priceafterd=print("Price after discount="+str(first+0.5*second)) print("Total price="+str(priceafterd*(1+tax/100))) else: priceafterd=print("Price after discount="+str(second+0.5*first)) print("Total price="+str(priceafterd*(1+tax/100)))

But there is a mistake, python shows

Traceback (most recent call last): File "/Users/jinkui/Documents/kj1143_hw3_q1.py", line 11, in print("Total price="+str(priceafterd*(1+tax/100))) TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

please help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!