import java.util.*;
import java.io.*;
//javac switch_break.java
public class switch_break
{
private static int player_no = 24;
public static String str = "";
public switch_break()
{ System.out.println("This is a constructor with no param");
}
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Type a line to end type exit at the end :");

String str = "";
int n = 0;
try{
System.out.println("---While Loop---");

int i = 0;
while (n != 5)
{
System.out.print("Please enter your age: ");
str = br.readLine();
n =Integer.parseInt(str);

switch (n)
{
case 0: System.out.println(" You entered " + n);
break;
case 1: System.out.println(" You entered :"+ n +" Freshman " );
break;
case 2: System.out.println(" You entered : " + n+ " Sophomore");
break;
case 3: System.out.println(" You entered : " + n + " Junior ");
break;
case 4: System.out.println(" You entered : " + n + " Senior ");
break;
default:System.out.println(" You entered " + n + " out of range");
break;
}
}
System.exit(0); //otherwise cursor will not return to DOS
}//try
catch(NumberFormatException e) { System.out.println("data was blank");}
}
}