C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Java - Switch Statement
WhatsApp
Senthilvelan Sambamoorthy
Aug 20
2016
643
0
0
ssvswitch.rar
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
Switch Statement
Up Next
Java - Switch Statement