import java.util.Scanner;
public class Q {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
System.out.println("请输入两个字符");
String s=scan.nextLine();
boolean flag=true;
String msg="";
if(s.length()==2){
String first=s.substring(0,1);
String second=s.substring(1);
if(first.equals("M")){
msg+="数学";
}else if(first.equals("C")){
msg+="计算机科学";
}else if(first.equals("I")){
msg+="信息技术";
}else{
flag=false;
}
msg+=" ";
if(second.equals("1")){
msg+="大一";
}else if(second.equals("2")){
msg+="大二";
}else if(second.equals("3")){
msg+="大三";
}else if(second.equals("4")){
msg+="大四";
}else{
flag=false;
}
}
if(flag){
System.out.println(msg);
}else{
System.out.println("输入不合法");
}
}
}
有问题请追问,没问题请采纳。