Computer Science, asked by navsripathi358, 9 months ago

5) Rewrite the following program segment using switch case.
char code;
if(code==’B’ || code==’b’)
System.out.println("Bank Manager");
if(code==’C’ || code==’c’)
System.out.println("Chartered Accountant");
if(code==’E’ || code==’e’)
System.out.println("Engineer");
if(code==’M’ || code==’m’)
System.out.println("Minister");

Answers

Answered by da4729204
0

Answer:

char code;

switch(code){

case 'B':

System.out.println("Bank Manager");

break;

case 'b':

System.out.println("Bank Manager");

break;

case 'C':

System.out.println("Chartered Accountant");

break;

case 'c':

System.out.println("Chartered Accountant");

break;

case 'E':

System.out.println("Engineer");

break;

case 'e':

System.out.println("Engineer");

break;

case 'M':

System.out.println("Minister");

break;

case 'm':

System.out.println("Minister");

break;

}

Similar questions