Shipping is free for online orders totaling $25 or more at Mississippi.com. Orders less than $25 are charged $6.00 for shipping. 7% sales tax is added for items that are taxable. A shopper is ordering one item, but possibly in multiple quantities. Write a program that prompts for the unit price of the item and the quantity desired. The program should also ask if the item is taxable and clearly indicate how the shopper should reply. Finally, the program should display a four line receipt that shows the extended price (subtotal) of the purchase, sales tax, shipping cost, and total amount due. All amounts should be in currency format as described in the requirements above.

Question
Asked Oct 16, 2019
130 views

Shipping is free for online orders totaling $25 or more at Mississippi.com. Orders less than $25 are charged $6.00 for shipping. 7% sales tax is added for items that are taxable. A shopper is ordering one item, but possibly in multiple quantities. Write a program that prompts for the unit price of the item and the quantity desired. The program should also ask if the item is taxable and clearly indicate how the shopper should reply. Finally, the program should display a four line receipt that shows the extended price (subtotal) of the purchase, sales tax, shipping cost, and total amount due. All amounts should be in currency format as described in the requirements above.

check_circle

Expert Answer

star
star
star
star
star
1 Rating
Step 1

Note: You didn't mention any language so i use Python

#get the inputs from the user

unit_cost = float(input('Enter the cost of the item: '))

quantity = int(input('Number of items: '))

taxable = input('Enter the item is taxable or not? [y/n] ').lower()

 

#calculate the subtotal

subtotal = unit_cost * quantity

 

#check "taxable" is "y"

if taxable.startswith('y'):

 

    #display the statement

    print("\nThe item is taxable")

 

    #calculate the "tax" amount

    tax = subtotal * 0.07

 

#otherwise

else:

    #set the value

    tax = 0.0

 

#check "subtotal" is greater than or equal to 25

if subtotal >= 25.0:

   

    #set the value

    shipping = 0

 

#otherwise

else:

   

    #set the value

    shipping = 6.0

 

#calculate the "total" amount

total = subtotal + tax + shipping

 

#display the outputs

print('Subtotal: $ {:.2f}'.format(subtotal))

print('Sales tax: $ {:.2f}'.format(tax))

print('Shipping: $ {:.2f}'.format(shipping))

print('Total: $ {:.2f}'.format(total))

Step 2

Screenshot of the progra...

help_outline

Image Transcriptionclose

#get the inputs from the user unit_cost float(input('Enter the cost of the item: ')) quantity int (input('Number of items: )) input(Enter the item is taxable or not? [y/n] ).lower() taxable calculate the subtotal subtotal unit cost quantity ncheck "taxable" is "y if taxable.startswith ('y'): display the statement print("nThe item is taxable") calculate the "tax mount tax subtotal e.87 rotherwise else Eset the value tax e.e IFcheck subtotal is greater than or equal to 25 if subtotal 25.8 : eset the value shipping fotherwise else: #set the value shipping 6.e calculate the "total amount total subtotal tax shipping Edisplay the outputs print'Subtotal: .2f.formnat (subtotal)) print('Sales tax: .2f.format (tax)) printShipping: .2f .format (shipping)) print( Total: $ (.2f).format (total))

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: In C++ Create a function called ApplyTax. The tax rate should be a const set to 8.75%.  ApplyTax sho...

A: Program designThe program has 3 parts – main function, ApplyTax function and TotalCost functionthere...

question_answer

Q: Create the following classes based on the given declaration. Also, each class should have the defaul...

A: Program DescriptionSince variables of vector type are to be declared we include the vector header fi...

question_answer

Q: What is Android pie?

A: Android is basically an operating system developed by Google for smartphones just like Windows is an...

question_answer

Q: ///////////// //////////// //////////// the language used is java

A: Program code #1:

question_answer

Q: PLEASE EXPLAIN ALL STEPS: simplify the boolean equations: xz + (xy + ~z) ~xyz + yz + x~y

A: 1)xz + (xy + ~z)For simplifying the Boolean expression, use Karnaugh Map and follow the below steps-...

question_answer

Q: What is a hot spot and what are the benefits and cons?

A: Hotspot:A physical location that can obtain an internet access using Wireless Fidelity (Wi-Fi) is ca...

question_answer

Q: In a file called RemoveVowels.java, write a program that: Asks the user to enter a word of text. Pr...

A: A java program to print the word with all vowels removed is given below;Program:File name: "RemoveVo...

question_answer

Q: In a file called Stars.java, write a program that: Asks the user to enter a positive integer N >...

A: // This JAVA program takes an input N>0//It prints a star pattern. 

question_answer

Q: All programming languages have a loop capability. Looping is the program logic’s ability to repeat o...

A: Program://inlcude the header files#include <iostream>using namespace std; //definition of main...