Question: Modify your Online Book Order program from week 5 to prompt the users for the number of books they are purchasing. Using a for loop,

Modify your Online Book Order program from week 5 to prompt the users for the number of books they are purchasing. Using a for loop, prompt the user for the cost of each book and store it into a subtotal. Use the subtotal and the number of books to pass to your method. No changes should be needed to your method or parameters. Output a receipt formatted as the following: Enter the number of books purchased: 4 Enter the book price for Book 1: 12.34 Enter the book price for Book 2: 23.33 Enter the book price for Book 3: 11.00 Enter the book price for Book 4: 13.55 Number of books purchased: 4 Book Subtotal: $60.22 ------------------------ Order Total: $69.53

This is what I had originally. Not sure if I did it right during that week. (numbers are interchangeable, I just used these first time round)

public class BookOrderKirkpatrick { public static void main(String[] args) { int numBooksPurchased = 5; double bookPrice = 10.00; double taxPercent = 0.055; double shippingCostPerBook = 1.50; double taxTotal = (taxPercent * bookPrice); double totalBookPrice = (bookPrice + taxTotal); double shippingTotal = (numBooksPurchased * shippingCostPerBook); double orderTotal = (numBooksPurchased * totalBookPrice + shippingTotal); System.out.println (orderTotal);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!