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
Math,
3 months ago
Science,
3 months ago
Math,
3 months ago
Social Sciences,
8 months ago
English,
8 months ago
Math,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago