Rewrite the following using switch-case construct: -
if (value ==1)
{
salary+=20000;
else if (value==2)
salary+=15000;
else if (value==3)
salary+=10000;
else
System.out.println(“Above Range”);
}
Answers
Answered by
4
Switch Case:
switch (value) {
case 1:
salary += 20000;
break;
case 2:
salary += 15000;
break;
case 3:
salary += 10000;
break;
default :
System.out.println("Above Range");
}
Answered by
1
Explanation:
Switch Case:
switch (value) {
case 1:
salary += 20000;
break;
case 2:
salary += 15000;
break;
case 3:
salary += 10000;
break;
default :
System.out.println("Above Range");
}
Similar questions
World Languages,
3 months ago
Math,
3 months ago
Social Sciences,
6 months ago
English,
6 months ago
Math,
10 months ago
Computer Science,
10 months ago
Math,
10 months ago