zoukankan      html  css  js  c++  java
  • java基础:学员状态查询

     1 package kaoshi;
     2 /*
     3  * 学员状态查询
     4  * @作者:向往的生活
     5  * @时间:2017、3、7
     6  */
     7 import java.util.Scanner;
     8 
     9 public class StudentState {
    10     public static void main(String[] args) {
    11         boolean flag=false;
    12         while(true){
    13             Scanner scan=new Scanner(System.in);
    14             System.out.print("请输入学员状态的第一个英文字母:");
    15             String input = scan.nextLine().toUpperCase();
    16             char chr = input.toCharArray()[0];
    17             switch (chr) {
    18             case 'E':
    19                 System.out.println("优秀");
    20                 flag=enquire(flag);
    21                 break;
    22             case 'G':
    23                 System.out.println("良好");
    24                 
    25                 flag=enquire(flag);
    26                 break;
    27             case 'S':
    28                 System.out.println("中等");
    29                 flag=enquire(flag);
    30                 break;
    31             case 'F':
    32                 System.out.println("不合格");
    33                 flag=enquire(flag);
    34                 break;
    35 
    36             default:
    37                 System.out.println("输入错误,无法转换");
    38                 flag=enquire(flag);
    39                 break;
    40             }
    41             if(flag==true){
    42                 System.out.println("退出系统!");
    43                 System.exit(-1);
    44             }
    45         }    
    46     }
    47     /*
    48      * 选择是否要继续查询
    49      */
    50     public static boolean enquire(boolean flag){
    51         while(true){
    52             Scanner scan=new Scanner(System.in);
    53             System.out.print("	
    ");
    54             System.out.print("您想继续吗? (y/n)");
    55             String input6 = scan.nextLine();
    56             System.out.print("	
    ");
    57             input6 = input6.toUpperCase();
    58             char chr6 = input6.toCharArray()[0];
    59             if(chr6=='N'){
    60                flag=true;
    61                return flag;
    62             }
    63             else if(chr6=='Y'){
    64                 return flag;
    65             }
    66             else{
    67                 System.out.println("输入错误,重新输入!");
    68             }
    69             }
    70     }
    71 }
  • 相关阅读:
    MySQL批量更新字段url链接中的域名
    巧用Win+R
    斯坦福高效睡眠法
    chkconfig: command not found
    Nginx(./configure --help)
    Ubuntu16.04配置Tomcat的80端口访问
    Binary Tree Level Order Traversal
    java——Arrays.asList()方法
    python 发送邮件
    常用邮件协议
  • 原文地址:https://www.cnblogs.com/jichuang/p/6516160.html
Copyright © 2011-2022 走看看