Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I wanna write a code about selling a T-shirt online for $9.99/each. I will give a discount to my customers depending on how many

Hi I wanna write a code about selling a T-shirt online for $9.99/each. I will give a discount to my customers depending on how many shirts they buy it.

40% off for 15 or more shirts

30% off for 10 or more shirts

20% off for 4 or more shirts

However, the shipping and handing will be charged for $1.05/ shirts.

Here the code that I wrote but there was something wrong with it pls help!

$$Python program$$

#if purchase 15 or more shirts, multiply by 0.4,asign to shirts #else if purchase 10 or more shirts, multiply by 0.3, assign to shirts #else if purchase 4 or more shirts, multiply by 0.2, assign to shirts #else multiply by 0.1, assign to shirts #shipping and handling = shirts * 1.05

def main(): ### get number of shirts from customer shirts = int(input('How many shirts are you purchasing')) ### the prices price = shirts * 9.99 ### determine the cost of shirts if shirts >= 15: discount= price * 0.4 elif shirts >= 10: discount= price * 0.3 elif shirts >= 4: discount= price * 0.2 else: discount= price * 0.1

### determine shipping and handling if shirts >= 15: shippingCharges = shirts * 1.05 else: shippingCharges = shirts * 1.05

### compute total amount due total = price - discount + shippingCharges

### display outputs in currency format print('Cost of shirts $',format(price,'.2f'),sep='') print('Cost of shirts after sales $',format(discount,'.2f'),sep='') print('Cost of shipment $',format(shippingCharges,'.2f'),sep='') print('Total payment $',format(total,'.2f'),sep='')

main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions