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);
}
}Java
Java - switch Statement

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
