Hi,
you did not read while post... I wrote
...You using switch..and while... when user enter that he like to VOTE you code goes to switch and enters case 2:... now in case 2 you ask for what team user likes to vote...
Here.. when user enters let say 2 for Barcelona.. you need to display
...
but i never tell you to delete this part of code :)
When you removed menu for voting, you remove input variable declaration and that's why you have number exception...
put this code back
String input = JOptionPane.showInputDialog(" Who will win the Champions League in 2010/11? "
+ "\n 1. Real Madrid"
+ "\n 2. Barcelona"
+ "\n 3. Chelsea"
+ "\n 4. Manchester United");
between line 49 and 50
and you are done program works...
For ++score you are ok, it is increment value of score than display new value, score++ is display score than increment value
But for case 3 no...
Now please remove case 3 (line 58-60) it will never execute because you intercept user answer for quit (3) in line 34 and quit program before it enters switch loop.
Like an extra for this code you can replace message in case 1: (lines 42-45) with this code
String messg="";
for (int a=1;a<game.length;a++)
messg +=" Current Score for " + game[a] + " is: " + score[a] + " \n";
JOptionPane.showMessageDialog(null,messg);
If you later add new team(s) you …