import java.io.*;
class ssvswitch
{
public static void main(String arg[]) throws IOException
{
String t,t1;
double allo=0;
int inc,cat;
double all;
DataInputStream dr = new DataInputStream(System.in);
System.out.print("Enter the Income : ");
t = dr.readLine();
inc = Integer.parseInt(t);
System.out.print("Enter the Category : ");
t1 = dr.readLine();
cat = Integer.parseInt(t1);
switch(cat)
{
case 1 : allo = 0.05;
break;
case 2 : allo = 0.07;
break;
case 3 : allo = 0.10;
break;
}
all = inc * allo;
System.out.println("\nAllowance to be paid : " + all);
}
}In this program, easy to understand switch concept using Java Program.
