Results 1 to 3 of 3
- 08-26-2011, 09:42 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
How to loop this CODE using do while
Java Code:import javax.swing.*; public class switchmove { public static void main(String[] args) { String wen = JOptionPane.showInputDialog(null, "Input your desire channel:", "Select", JOptionPane.PLAIN_MESSAGE); int w=Integer.parseInt(wen); switch (w) { case 2: JOptionPane.showMessageDialog(null, "ABS-CBN", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 5: JOptionPane.showMessageDialog(null, "RPN", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 9: JOptionPane.showMessageDialog(null, "CS 9 TV", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 12: JOptionPane.showMessageDialog(null, "GMA", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 20: JOptionPane.showMessageDialog(null, "IBC", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 21: JOptionPane.showMessageDialog(null, "TV 5", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 23: JOptionPane.showMessageDialog(null, "Studio 23", "Result", JOptionPane.INFORMATION_MESSAGE); break; case 39: JOptionPane.showMessageDialog(null, "COC tv", "Result", JOptionPane.INFORMATION_MESSAGE); break; default: JOptionPane.showMessageDialog(null, "WALA mani nga CHANNEL", "Result", JOptionPane.ERROR_MESSAGE); break; } } }Last edited by JosAH; 08-26-2011 at 11:21 AM. Reason: added [code] ... [/code] tags
- 08-26-2011, 11:03 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,540
- Rep Power
- 11
Also posted with the title "How to loop this CODE using For loop".
-----
Read through Control Flow Statements in Oracle's Tutorial. It may solve your problem or it may help you to ask a question. If you ask a question a couple of things to keep in mind are that people will want to see your attempt, or a specific statement from the Tutorial or elsewhere that you would like to have explained. And when posting code there is no reason for it to include a lot of "clutter" like the message dialogs and their associated messages which really have nothing to do with loops.
- 08-26-2011, 04:46 PM #3
Member
- Join Date
- Jul 2010
- Posts
- 43
- Rep Power
- 0
Similar Threads
-
JTextField loop 2x for-loop WEIRD!
By Streetproject in forum AWT / SwingReplies: 2Last Post: 02-16-2011, 05:46 PM -
code wont enter into loop. thanks in advance for your help
By farahm in forum Advanced JavaReplies: 7Last Post: 11-22-2010, 02:38 PM -
Why isn't this while loop code working
By GreenTea in forum New To JavaReplies: 16Last Post: 11-10-2010, 03:14 AM -
while-loop stopping on first loop
By davester in forum New To JavaReplies: 6Last Post: 06-26-2009, 08:46 PM -
while loop skips code
By ejs7597 in forum New To JavaReplies: 3Last Post: 02-28-2009, 03:07 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks