Hello.
So far, I am in my 3rd week of Java programming and I've finally run into a bit of a problem. We were given an assignment of the following:
Scenario 1: Customer purchases all 9 items Please enter your name: Lisa Miller (This is what the sample output looked like)
GRAPEFRUIT PRODUCT
1. gPod shuffle $49
2. gPod Touch $299
3. gPad Mini $329
4. gPad 2 $399
5. gPhone $199
6. gMac $1299
7. MacNovel Pro $1199
8. MacNovel Air $999
9. MiniMac $599
10. Complete my order
Please select an item from the menu above: 5
Please select anotheritem from themenu above: 2
etc,
Thank you for ordering with Grapefruit Company, Lisa Miller
Total items ordered: 9
Price of items ordered: $5371
Sales tax: $ 349.115
Total amount due: $ 5720.115
package onlineordering; import java.util.Scanner; /** * * @author jamesbottom */ public class OnlineOrdering { /** * @param args the command line arguments */ public static void main(String[] args) { //Declare variables final int GPOD_SHUFFLE = 49; final int GPOD_TOUCH = 299; final int GPAD_MINI = 329; final int GPAD_2 = 399; final int GPHONE = 199; final int GMAC = 1299; final int MACNOVEL_PRO = 1199; final int MACNOVEL_AIR = 999; final int MINIMAC = 599; int nProductNumber = 0; int nSum = 0; Scanner input = new Scanner(System.in); //Prompt user for name System.out.print("Please enter your name: "); //Get/read name String name = input.next(); //Create a line space System.out.println(); //Display list of products for customer System.out.println("GRAPEFRUIT PRODUCT" + '\n' + "1. gPod shuffle" + " $" + GPOD_SHUFFLE + '\n' + "2. gPod Touch" + " $" + GPOD_TOUCH + '\n' + "3. gPad Mini" + " $" + GPAD_MINI + '\n' + "4. gPad 2" + " $" + GPAD_2 + '\n' + "5. gPhone" + " $" + GPHONE + '\n' + "6. gMac" + " $" + GMAC + '\n' + "7. MacNovel Pro" + " $" + MACNOVEL_PRO + '\n' + "8. MacNovel Air" + " $" + MACNOVEL_AIR + '\n'+ "9. MiniMac" + " $" + MINIMAC + '\n' + "10. Complete my order"); }//end main method }//end class OnlineOrdering
I don't understand what type of loop I should be doing. If anyone can point me in the right direction, I'd be really grateful.