Your program had a little errors mostly wrong tokens.
I modified your code and works ok.
But first I want to say where the errors were.
QUOTE
import.javax.swing.*:
should be
CODE
import javax.swing.*:
QUOTE
case 6;
status = Doctoral Program";
break;
should be
CODE
case 6:
status = "Doctoral Program";
break;
and
QUOTE
JoptionPane.showMessageDialog(null, status, "Program", JOptionPane.INFORMATION_MESSAGE);
should be
CODE
JOptionPane.showMessageDialog(null, status, "Program", JOptionPane.INFORMATION_MESSAGE);
just small errors.
Here is the code that works:
CODE
import javax.swing.*;
public class Status
{
public static void main(String[] args)
{
String s1, status;
int code;
s1 = JOptionPane.showInputDialog("Enter a number:");
code = Integer.parseInt(s1);
switch (code)
{
case 1:
status = "Freshman";
break;
case 2:
status = "Sophomore";
break;
case 3:
status = "Junior";
break;
case 4:
status = "Senior";
break;
case 5:
status = "Masters Program";
break;
case 6:
status = "Doctoral Program";
break;
default:
status = "An incorrect code was entered";
}
JOptionPane.showMessageDialog(null, status, "Program", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}