Write a program to determine the shipping costs for an online purchase. Prompt the user for the number of items using the following prompt: Enter the number of items: Prompt the user for the purchase price of using the following prompt: Enter the purchase price: $ Calculate the sales tax as 8.25% of the purchase price Calculate the shipping costs as a flat rate using the following information: Number of items Shipping cost 1-6 $8.00 7-12 $4.50 more than 12 $1.00 Calculate the total cost as the sum of the purchase price, sales tax and shipping cost Output the sales tax and shipping costs using the following example: Purchase price: $##.## Sales tax: $##.## Shipping cost: $##.## Total cost: $##.## Note: To format the output for 2 decimals use the following include statement: #include and prior to the output statements include the following statement: cout << fixed << setprecision(2); Write in C++

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program to determine the shipping costs for an online purchase.

  1. Prompt the user for the number of items using the following prompt:
    Enter the number of items:

  2. Prompt the user for the purchase price of using the following prompt:
    Enter the purchase price: $

  3. Calculate the sales tax as 8.25% of the purchase price

  4. Calculate the shipping costs as a flat rate using the following information:

    Number of items Shipping cost
    1-6 $8.00
    7-12 $4.50
    more than 12 $1.00
  5. Calculate the total cost as the sum of the purchase price, sales tax and shipping cost

  6. Output the sales tax and shipping costs using the following example:
    Purchase price: $##.##
    Sales tax: $##.##
    Shipping cost: $##.##
    Total cost: $##.##

Note: To format the output for 2 decimals use the following include statement:
#include <iomanip>
and prior to the output statements include the following statement:
cout << fixed << setprecision(2);

Write in C++

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education