Question

In: Computer Science

We are going to include various discount to the online order for the chocolate company. Remember...

We are going to include various discount to the online order for the chocolate company.

Remember from Program #2:

The online store sells the following gourmet chocolates:

  • Milk Chocolate @ $8.50 per box
  • Dark European Chocolate @ $9.75 per box
  • White Chocolate @ $10.50 per box
  • European Truffles @ $12.50 per box

Now for Program #3, also include the following order discount available:

The store allows a customer discount based on:

  1. Under $20.00              No Discount
  2. $20.00 to $39.99         10% off
  3. $40.00 to $59.99         15% off
  4. $60.00 to $79.99         20% off
  5. $80.00 and over          25% off

Net Subtotal = Gross Subtotal – Discount

Company charges a 10% Shipping and Handling fee and a 9.5% Sales Tax (sales tax rate).

Both Shipping & Handling and Sales Tax is based on Net Subtotal.

Invoice Total is Net Subtotal plus Shipping and Handling plus Sales Tax.

Using a nested IF…ELSE...IF, determine the discount based on the gross subtotal of the order (excluding the shipping and handling.

Sample Output (bold italic in red is user input during execution of the program)

Enter Customer ID: AF101

Number of box of Milk Chocolate @ $8.50: 2

Number of box of Dark European @ $9.75: 1

Number of box of White Chocolate @ $10.50: 3

Number of box of European Truffle @ $12.50: 0

Invoice for Customer AF101:

2 Milk Chocolate @$8.50 per box                 $ 17.00

1 Dark European @$9.75 per box                $   9.75

3 White Chocolate @$10.50 per box          $ 31.50

0 European Truffles @$12.50 per box        $ 0.00

Subtotal                                          $ 58.25

Less Discount of 15.0 %        $    8.74

Net Subtotal                            $ 49.51

Shipping @ 10.0 %                 $   4.95

Sales Tax @ 9.5%                  $    4.70

Grand Total                             $ 59.16

Solutions

Expert Solution

Answer :

Here is the python code as per your requiremet

Raw code:

#ASKING INPUTs from user

id=input('Enter Customer ID: ')

milkChoclates=int(input('Number of box of Milk Chocolate @ $8.50: '))

darkEuroChoclates=int(input('Number of box of Dark European @ $9.75: '))

whiteChoclate=int(input('Number of box of White Chocolate @ $10.50: '))

euroTruffle=int(input('Number of box of European Truffle @ $12.50: '))

#calculating cost of each by multiplying the number of quantity

milkChoclatesCost=8.50*milkChoclates

darkEuroChoclatesCost=9.75*darkEuroChoclates

whiteChoclateCost=10.50*whiteChoclate

euroTruffleCost=12.50*euroTruffle

#total

subTotal=milkChoclatesCost+darkEuroChoclatesCost+whiteChoclateCost+euroTruffleCost

#condtions to decide discount percentage

if subTotal<20.00:

discount=0

elif subTotal>=20.00 and subTotal<=39.99:

discount=10

elif subTotal>=40.00 and subTotal<=59.99:

discount=15

elif subTotal>=60.00 and subTotal<=79.99:

discount=20

elif subTotal>=80:

discount=25

#get the discount price

discountPrice=(discount/100)*subTotal

#subtract discount price from total price

netSubtotal=subTotal-discountPrice

#shipping cost 10%

shippingCost=(10/100*netSubtotal)

# sales tax 9.5%

salesTax=(9.5/100*netSubtotal)

#total taxes

taxes=shippingCost+salesTax

#grand total

grandTotal=(netSubtotal+taxes)

#print statements

invoice='''

Invoice for Customer {}:

{} Milk Chocolate @$8.50 per box $ {:.2f}

{} Dark European @$9.75 per box $ {:.2f}

{} White Chocolate @$10.50 per box $ {:.2f}

{} European Truffles @$12.50 per box $ {:.2f}

Subtotal $ {:.2f}

Less Discount of {:.2f} % $ {:.2f}

Net Subtotal $ {:.2f}

Shipping @ 10.0 % $ {:.2f}

Sales Tax @ 9.5% $ {:.2f}

Grand Total $ {:.2f}

'''.format(id,milkChoclates,milkChoclatesCost,darkEuroChoclates,darkEuroChoclatesCost,whiteChoclate,whiteChoclateCost,euroTruffle,euroTruffleCost,subTotal,discount,discountPrice,netSubtotal,shippingCost,salesTax,grandTotal)

#printing invoice

print(invoice)

Editor:

Hope this helps you! If you still have any doubts or queries please feel free to comment in the comment section.

"Please refer to the screenshot of the code to understand the indentation of the code".

Thank you! Do upvote.


Related Solutions

An Internet gourmet foods company, “Yumminess”, will be including “Chocolate Attack Brownies” (CAB) in their online...
An Internet gourmet foods company, “Yumminess”, will be including “Chocolate Attack Brownies” (CAB) in their online catalog. CAB will be sold in square tins and captioned with personal greetings. Jordan negotiated a selling price to Yumminess at $10 per tin. You, using your accounting knowledge, had previously budgeted a cost of $8 per tin, which includes $6 of direct material and $1.50 of direct labor. Annual manufacturing overhead is estimated at $100,000 for the expected sales of 200,000 tins. Operating...
Problem 1: Evaluation of a known integral using various quadratures: In this problem, we are going...
Problem 1: Evaluation of a known integral using various quadratures: In this problem, we are going to compute the price of a European call option with 3 month expiry, strike 12, and implied vol 20, Assume the underlying is 10 now and the interest rate is 4%. 1. Use Black-Scholes formula to compute the price of the call analytically. 2. Calculate the price of the call numerically using the following 3 quadrature methods: (a) Left Riemann rule (b) Midpoint rule...
Explain why we have to discount the cash flows in order to evaluate the net present...
Explain why we have to discount the cash flows in order to evaluate the net present value. What is the role of the discount rate? Use a numerical example in you excel file and calculate the NPV using the NPV EXCEL function, the usage of the PV & SUM EXCEL functions and the mathematical formula for the present value calculation.
Candy Company is considering purchasing a second chocolate dipping machine in order to expand their business....
Candy Company is considering purchasing a second chocolate dipping machine in order to expand their business. The information StupendousStupendous has accumulated regarding the new machine​ is: Cost of the machine $110,000 Increased contribution margin $17,000 Life of the machine 10 years Required rate of return 6% StupendousStupendous estimates they will be able to produce more candy using the second machine and thus increase their annual contribution margin. They also estimate there will be a small disposal value of the machine...
The company manufactures chocolate bars with nominal weight of 115 g per bar. In order to...
The company manufactures chocolate bars with nominal weight of 115 g per bar. In order to to avoid risk of short changing, the mean weight is set as 117 g and SD of 2 g. Assuming that 40 chocolate bars are selected, 97% of the sample means will be between what value? ( give the upper and lower value)
The company manufactures chocolate bars with nominal weight of 115 g per bar. In order to...
The company manufactures chocolate bars with nominal weight of 115 g per bar. In order to to avoid risk of short changing, the mean weight is set as 117 g and SD of 2 g. What is the probability that : (a) a random chocolate bar weighs between 116 gram and 120 gram? (b) a particular sample mean would be less than 116.5 millimeters chosen of 40 random samples of chocolate bar.
Research Hershey's Chocolate company online, dig around their website, click on everything, learning what you can...
Research Hershey's Chocolate company online, dig around their website, click on everything, learning what you can about the firm's goods and services, work processes, and facilities. a then create a chart identifying risks you believe the company faces - and the ways the firm can avoid those risks or reduce the risks. please make sure to include the web address for the firm.
In this unit we discuss the various budgets that are prepared by a company or organization....
In this unit we discuss the various budgets that are prepared by a company or organization. The process of budgeting is actually similar to how we budget in our own individual, personal lives. In this discussion post, I would like you to discuss your own budgeting process (please address each of the bullets below): How do you budget your own finances? You don't have to give exact amounts and details, just an overview of your process and various groups of...
In this unit we discuss the various budgets that are prepared by a company or organization....
In this unit we discuss the various budgets that are prepared by a company or organization. The process of budgeting is actually similar to how we budget in our own individual, personal lives. I would like you to discuss your own budgeting process (please address each of the bullets below): How do you budget your own finances? You don't have to give exact amounts and details, just an overview of your process and various groups of expenses that you have...
Question. 1 A tourist company organizes various types of sight tours, offering some discount rates for...
Question. 1 A tourist company organizes various types of sight tours, offering some discount rates for certain types of customers, among them children (under 12) and seniors (over 65 years of age). The company wants to estimate the total number of seniors in its tours on the basis of a random sample of site tours recorded in their books. Each tour record shows the number of seniors, the number of children, and some other data. There were 4,000 tours organized...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT