Rewrite the following JAVA program segment using switch case..
char code;
if(code=='B'||code=='b')
System.out.println("Businessman");
if(code=='F'||code=='f')
System.out.println("Fighter");
if(code=='E'||code=='e')
System.out.println("Employee");
if (code=='I'||code=='i')
System.out.println("Intelligent");
plzzzz plzzz answer me fast i want this right now....plz help me....
Answers
switch(ch);
case 1:
{
If(code=='B'||code=='b')
System.out.println("Businessman");
break;
}
Case 2:
{
if(code=='F'||code=='f')
System.out.println("Fighter");
break;
}
case 3:
{
if(code=='E'||code=='e')
System.out.println("Employee");
break;
}
case 4:
if (code=='I'||code=='i')
System.out.println("Intelligent");
break;
default:
System.out.println("You have entered incorrect thing");
}
Hope it helps..
Mark brainliest
Sample Java Program:
switch(code)
{
case 'B' : System. out. println("Businessman");
break;
case 'F' : System. out. println("Fighter");
break;
case 'E' : System. out. println("Employee");
break;
case 'I' : System. out. println("Intelligent");
break;
case 'b' : System. out. println("Businessman");
break;
case 'f' : System. out. println("Fighter");
break;
case 'e' : System. out. println("Employee");
break;
case 'i' : System. out. println("Intelligent");
break;
default : System. out. println("Brainliac");
}
Output:
Choose an alphabet:
e
Employee.
Hope it helps!