You're going to add some error checking and additional features, to Keychains2.
You need to make sure that the user always has a positive number, or 0, of keychains in the order.
You need to check for a valid menu choice. If not, display an error message and show the menu again.
You will need 3 new variables in main, one to store the sales tax (8.25%), one to store the shipping cost per order ($5.00), and one to store the additional per keychain shipping cost ($1.00).
view_order() will need to be passed the three additional variables, a total of five, and have a return type of void. It will display, on different lines, the number of keychains in the order, the price per keychain, the shipping charges on the order, the subtotal before tax, the tax on the order, and the final cost of the order.
view_order() might look like public static void view_order( int num_keychains, double price_per_keychain, double tax, int base_shipping, int per_keychain_shipping )
checkout() will need to be passed the same values as view_order(), and have a return type of void. It will ask the user for his/her name in order to deliver them correctly, then call view_order() to display the order information, and then thank the user, by name, for ordering.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.