Results 1 to 3 of 3
- 09-28-2008, 05:48 AM #1
Member
- Join Date
- Sep 2008
- Posts
- 14
- Rep Power
- 0
[SOLVED] JOptionPaneMessage dialog question
i am doing a program about vending machine. i want to do in the JOptionPane way instead of scanner scan (println)...
so if user enter option " 1 " , then count1 ++...after that user terminate the program ( by enter 5 ) , the println will print out the item sold , by checking each count condition( count1 , count 2...)Java Code:while(option!=5){ if(option==1){ count1++; System.out.println("Here is your gum\n");} else if(option==2){ count2++; System.out.println("Here is your chocolate\n");} else if(option==3){ count3++; System.out.println("Here is your popcorn \n");} else if(option==4){ count4++; System.out.println("Here is your juice \n");} System.out.println("[1] Get gum\n[2] Get chocolate\n[3] Get popcorn\n[4] Get juice\n" + "[5] Display total sold\noption : "); option= scan.nextInt(); }
in this case , " 1 items of gum were sold " will print out
so my question is , if there any method that i can use JOptionPaneMessageDialog to show these result , i mean only the sold items display in ONE JOptionPaneMessageDialogJava Code:if(count1>0){ //results System.out.println( count1+" items of gum were sold"); } if (count2>0){ System.out.println(count2+" items of chocolate were sold");} if (count3>0){ System.out.println( count3+" items of popcorn were sold");} if (count4>0){ System.out.printf(count4+" items of juice were sold");}
i will appreciate if someone can reply me:)Last edited by blueyan; 09-28-2008 at 06:57 AM.
- 09-28-2008, 06:56 AM #2
Member
- Join Date
- Sep 2008
- Posts
- 14
- Rep Power
- 0
i got the solution already , post closed
- 09-28-2008, 07:50 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Nice to see that you have figure out the problem yourself. When you do it next time, I mean after solve your problem, mark it as solved using Thread Tools.
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Dialog
By JavaLerner in forum AWT / SwingReplies: 27Last Post: 07-07-2008, 11:29 AM -
Example of SWT Dialog
By Java Tip in forum Java TipReplies: 0Last Post: 01-09-2008, 12:01 PM -
Dialog Box
By uncopywritable in forum New To JavaReplies: 2Last Post: 07-30-2007, 12:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks