zoukankan      html  css  js  c++  java
  • 成绩划分 处理异常

    源代码:

    import java.util.Scanner;
    public class Score {

        public static void main(String[] args) {
        // TODO Auto-generated method stub
            Scanner input = new Scanner(System.in);

            String s;
            System.out.println("请输入课程成绩:");
            s = input.nextLine();

            try{
                int i = Integer.valueOf(s);
                if( i<60&& i>=0)
                    System.out.println("该成绩不及格");
                if( i>=60&& i<70)
                    System.out.println("该成绩及格");
                if (i>=70&& i<80)
                    System.out.println("该成绩中等");
                if( i>=80&& i<90)
                    System.out.println("该成绩良好");
                if( i>90&&i<=100)
                    System.out.println("该成绩优秀");
                }
            catch(Exception e){
                System.out.println("输入错误");
                }
        }

    }

    结果截图:

  • 相关阅读:
    最短路回顾
    树链剖分【模板】
    grep 、find 、tree 新发现
    网口划VLAN
    JDK安装
    网口做trunk
    PXE搭建
    C# 生成DLL文件
    在form窗体里面 寻找当前焦点的控件
    在屏幕右下方显示提示信息(winform窗体)(借鉴)
  • 原文地址:https://www.cnblogs.com/96ZYJ/p/4964248.html
Copyright © 2011-2022 走看看