Question: Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should
Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (S for standard shipping and E for expedited shipping). The program will produce a bill showing the subtotal, the sales tax,the discount, the shipping charge, and the final total for the sale.
The program will continue processing the next book sale until the number of books sold is zero.
Sales tax is calculated on the subtotal and is 5%. The discount is also calculated on the subtotal. The store offers no discount if the subtotal is less than $50, 10% discount if subtotal if $50-$100, and 15% discount if the subtotal is above $100. The store will charge $4.99 for standard shipping and $12.99 for expedited shipping.
A sample output of the program should look like follows.
> ./a.out
Book Sale calculator
----------------------------
Enter the number of books in the sale: 5
Enter price: 2.99
Enter price: 12.45
Enter price: 13.23
Enter price: 21.99
Enter price: 24.59
Enter shipping method [S]Standard shipping [E]Expedited shipping: S
Subtotal: $75.25
Tax: $3.76
Discount: $7.53
Shipping: $4.99
Total: $76.48
Enter the number of books in the sale: .
Also use the following data to test your program:
3 books, $8.99 $12.45 $7.58, Expedited shipping
Subtotal: $29.02
Tax: $1.45
Discount: $0.00
Shipping: $12.99
Total: $43.46
7 books, $5.66 $12.35 $23.56 $40.00 $12.99 $16.32 $11.23, Standard shipping
Subtotal: $122.11
Tax: $6.11
Discount: $18.32
Shipping: $4.99
Total: $114.89
PLEASE NOTE VERY IMPORTANT:
The program is WELL DOCUMENTED , including a header and documentations inside the main() function.
The program asks for input in correct order and terminates when the user enter 0 as the number of books
The program computes and outputs results correctly for each book sale.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
