String s = input.nextLine();
char s1 = s.charAt(0);
char s2 = s.charAt(1);
switch(s1)
{
case ‘M’:
System.out.print("Mathematics ");
switch(s2){
case ‘1’:
System.out.println(“Freshman”);
break;
case ‘2’:
System.out.println(“Sophomore”);
break;
case ‘3’:
System.out.println(“Junior”);
break;
case ‘4’:
System.out.println(“Senior”);
break;
default:
;
}
break;
case ‘C’:
System.out.print("Computer science ");
switch(s2){
case ‘1’:
System.out.println(“Freshman”);
break;
case ‘2’:
System.out.println(“Sophomore”);
break;
case ‘3’:
System.out.println(“Junior”);
break;
case ‘4’:
System.out.println(“Senior”);
break;
default:
;
}
break;
case ‘I’:
System.out.print("information technology ");
switch(s2){
case ‘1’:
System.out.println(“Freshman”);
break;
case ‘2’:
System.out.println(“Sophomore”);
break;
case ‘3’:
System.out.println(“Junior”);
break;
case ‘4’:
System.out.println(“Senior”);
break;
default:
;
}
break;
default:
System.out.print(“Invalid input”);
}
}
}
=================================================================
package demo;
import java.util.Scanner;
public class Welcome {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as String: ");
String a = input.ne