Question
Edit your OnlineBookOrderYourLastName.java program. Copy and paste it into the same Week 5 project with the new name - BookOrderSentinelYourLastName.java. Remove the prompt for the
Edit your OnlineBookOrderYourLastName.java program. Copy and paste it into the same Week 5 project with the new name - BookOrderSentinelYourLastName.java. Remove the prompt for the user to provide the number of books purchased. Modify your program to receive book prices until a sentinel value is entered. (Be sure to tell your user what the sentinel value is so they can type it to indicate they are finished with entering input.) After the sentinel value is entered, compute the total book order total and return the following to the user.
As book prices are entered, you'll need to have some way to capture the number of books they ordered and the running subtotal for use in the total book order price.
Compute the tax and shipping as usual (tax is 5.5 percent of the total book price & shipping charge is $1.50 per book). The price of the order is still the sum of the total book price, the tax, and the shipping charge. Output a receipt formatted as the following:
Enter the book price and press enter or type 999 when you are finished added books: 12.22 Enter another book price and press enter or type 999 when you are finished added books: 12.00 Enter another book price and press enter or type 999 when you are finished added books: 13.33 Enter another book price and press enter or type 999 when you are finished added books: 999
Number of books purchased: 3 Book Subtotal: $37.55 Tax: $2.07 Shipping: $4.50 ------------------------ Order Total: $44.12 |
IMPORTANT TESTING NOTE: Double check your math to make sure your sentinel value isn't being added into the book total and that you don't end up with an extra book in the number of books purchased. You can prevent that by setting up your loop correctly. If you are subtracting 1 from the book count or subtracting the sentinel value, you do not have your loop set up correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started