doyousmellcarrots
December 7th, 2009, 01:37 AM
I'm doing a practice exercise in my Java textbook that is confusing me.
I'm supposed to write a do...while statement that uses the JOptionPane.showInputDialog method to retrieve the quantity, name and and price of a food item in three different dialog boxes. the program is supposed to do this 3 times for a purchase of 3 items total. where I get stuck is when the book tells me I need to "use the value of variable counter in the input dialog prompts to indicate that the user is inputting information for the first, second or third item." how can I change input = JOptionPane.showInputDialog( null, "Enter Quantity of Item 1");
to contain ( null, "Enter Quantity of Item 2"); and ( null, "Enter Quantity of Item 3"); and so on and so forth without writing the code for 9 different JOptionPane Input Dialog boxes?
I'm supposed to write a do...while statement that uses the JOptionPane.showInputDialog method to retrieve the quantity, name and and price of a food item in three different dialog boxes. the program is supposed to do this 3 times for a purchase of 3 items total. where I get stuck is when the book tells me I need to "use the value of variable counter in the input dialog prompts to indicate that the user is inputting information for the first, second or third item." how can I change input = JOptionPane.showInputDialog( null, "Enter Quantity of Item 1");
to contain ( null, "Enter Quantity of Item 2"); and ( null, "Enter Quantity of Item 3"); and so on and so forth without writing the code for 9 different JOptionPane Input Dialog boxes?