Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System. enter the product ID (the number to the left of the item name) that you wish to
- purchase.
- //Loop the number of times the customer entered for the number of items
- for(int loopCounter 0; loopCounter < itemsToPurchase; loopCounter++){
- //Promote the user and get item number from keyboard
- System.out.print("Please enter item ID number "+(loopCounter + 1)+":
- int itemID = keyboard.nextlnt();
- // Test which item the user entered
- //User entered 1
- if(itemID = 1)
- totalAmount = totalAmount + tennisShoeCost;
- //User entered 2
- if(item1D = 2)
- totalAmount = totalAmount + shirtCost;
- //User entered 3
- if(itemID = 3)
- totalAmount = totalAmount + coatCost;
- //User entered 4
- if(itemID = 4)
- totalAmount = totalAmount + beltCost;
- //User entered 5
- if(item1D = 5)
- totalAmount = totalAmount + pantCost;
- // The loop is complete, calculate the taxes and display the results
- double taxAmount = totalAmount * taxRate;
- //Show the results
- System. out. println("
- System. sales total $"+totalAmount);
- System. sales tax is $"+taxAmount);
- System. out.println("The total amount due is $"+(totalAmount + taxAmount));
- System. out. println("
- file:///C/Users/eamoore/Docments/PRG215r4 JavaProgramming/fromSMEs/PRG215 Source/srcweek 2/PRG215 Week 2.bå[7/27/2017 PM]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement