968 views
4 votes
Create a program that calculates the total for a purchase at a bookstore. Put the lines of code in order to create the following program.

Sample output:
Bookstore Calculator
Price of Book 29.99
Tax percent 8.75
Tax amount 2.63
Total amount 32.61
1. tax_amount = round(book_price *
(tax_percent / 100), 2)
2.print("Bookstore Calculator")
3. print("Tax amount: ", tax_amount)
4. tax_percent = float(input("Tax percent: "))
5. # get input from the user
6. # display a welcome message
7. total = round(book_price + tax_amount, 2)
8. print("Total amount:", total)
9. # display the results
10. book_price = float(input("Price of book: "))
11. # calculate tip and total amount

User Mclayton
by
4.8k points

1 Answer

2 votes

Answer:

The correct order is:

# display a welcome message

print("Bookstore Calculator")

# get input from the user

book_price = float(input("Price of book: "))

tax_percent = float(input("Tax percent: "))

# calculate tip and total amount

tax_amount = round(book_price *(tax_percent / 100), 2)

total = round(book_price + tax_amount, 2)

# display the results

print("Tax amount: ", tax_amount)

print("Total amount:", total)

Step-by-step explanation:

Given

The above code segment

Required

Place the code in correct order

Using the sample output as a guide:

The first output is a welcome message.

So, the first and second line of the program is:

# display a welcome message

print("Bookstore Calculator")

Next, inputs for book price and tax percent.

So, the next lines are:

# get input from the user

book_price = float(input("Price of book: "))

tax_percent = float(input("Tax percent: "))

Next, outputs for tax amount and total amount.

These outputs must first be calculated.

So, the next lines are:

# calculate tip and total amount

tax_amount = round(book_price *(tax_percent / 100), 2)

total = round(book_price + tax_amount, 2)

Lastly, the results are printed

# display the results

print("Tax amount: ", tax_amount)

print("Total amount:", total)

User Ziarno
by
4.9k points