第一次上机考试

import java.util.*;
public class Test {
 public static void main(String[] args){
  char c1,c2='Y';
  System.out.print("*****************欢迎使用学员状态转换器*******************\n");
  while(c2!='N'){

  /*以下是我当时的错误输入单独字母的方法
   getChar ch=new getChar();  
   System.out.print("请输入学员第一个英文字母:");
   c1 = ch.getChar();*/
   Scanner s=new Scanner(System.in);
     System.out.print("请输入学员第一个英文字母:");
    String str=s.nextLine();
     c1=str.charAt(0);
   switch(c1){
    case 'E':{
     System.out.print("优秀\n");
     break;
    }
    case 'G':{
     System.out.print("良好\n");
     break;
    }
    case 'S':{
     System.out.print("中等\n");
     break;
    }
    case 'F':{
     System.out.print("不合格\n");
     break;
    }
    case 'H':{
     System.out.print("输入错误,无法转换\n");
    }
   }
     System.out.print("您想继续吗?(Y/N)\n");
     c2=str.charAt(0);
  }
  System.out.print("\n退出系统!");
 }
}

posted on 2014-04-11 08:16  HAPZQC  阅读(132)  评论(0)    收藏  举报

导航