Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this problem, you will calculate the total cost of an order at a restaurant. Assume that the order consists of 2 side salads, 2

In this problem, you will calculate the total cost of an order at a restaurant. Assume that the order consists of 2 side salads,
2 hamburgers, and 2 diet sodas. Assume also that the side salads cost $3.95 each, the hamburgers cost $8.95 each, and the
sodas cost $2.50 each. Assume that the sales tax rate is 4.75% and the customers left a 15% tip.
Perform the following steps in a single code cell.
1. Use the * operator to calculate the total cost of the side salads. Store the result in a variable named ss_cost.
2. Use the * operator to calculate the total cost of the hamburgers. Store the result in a variable named hb_cost.
3. Use the * operator to calculate the total cost of the diet sodas. Store the result in a variable named ds_cost.
4. Add the variables created in Steps 13, storing the results in a variable named subtotal.
5. Calculate the tax charge by multiplying the subtotal by 0.0475. Round this result to 2 decimal places, and store
the rounded value in a variable named tax.
6. Calculate the tip amount by multiplying the subtotal by 0.15. Round this result to 2 decimal places, and store
the rounded value in a variable named tip.
7. Calculate the total charge by adding the subtotal, the tax charge, and the tip amount. Store the result in a
variable named total_charge.
8. Print the results with descriptive text output as shown below. Replace the xxxxx symbols with the appropriate
values. Match the formatting shown below exactly, including spacing. The dashed lines should contain 22
dashes. The dollar signs should be vertically aligned, and the prices should be right-aligned with each other and
with the dashed lines. There should be five characters of spacing allotted for each price, but some prices will
only require four spaces. Each price should have exactly two decimal places displayed. This formatting can be
most easily accomplished using f-strings

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

Step: 3

blur-text-image

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

10-9 How have social technologies changed e-commerce?

Answered: 1 week ago