zoukankan      html  css  js  c++  java
  • 动手动脑

    /*编写一个程序,此程序在运行时要求用户输入一个 整数,代表某门课的考试成绩,程序接着给出“不及格”、“及格”、“中”、“良”、“优”的结论。
    李国帅   2015.11.11*/
    import java.util.Scanner;
    class Scored{
     int scored;
     private Scanner sc; 
     void get(){
      sc = new Scanner(System.in);
      try{
      System.out.println("请输入0到100间的成绩");
      scored=sc.nextInt();
      }
      catch ( ArithmeticException e){
       System.out.println("请输入有误,请重输");
       get();
      }
     catch(Exception e){
             System.out.println("请输入有误,请重输");
             get();
             }
     }
     void show(){
      if(scored<60&&scored>=0)
       System.out.println("不及格");
         if(scored<70&&scored>=60)
       System.out.println("及格");
      if(scored<80&&scored>=70)
       System.out.println("中");
      if(scored<90&&scored>=80)
       System.out.println("良");
      if(scored<=100&&scored>=90)
       System.out.println("优");
      if(scored>100||scored<0)
      {
       System.out.println("输入范围不合适,请重输");
      get();
      show();
      }
      
     }
     
    }
    public class Fen extends Scored{
     public static void main(String Args[]){
      Scored sco=new Scored();
      
          sco.get();
       sco.show();
      
      
     }
    }

  • 相关阅读:
    bzoj_auto_submiter(辣鸡Py毁我青春系列)
    听说“辣鸡小隔膜”出V1.3了?
    shell脚本:统计分析 /home/ 目录用户磁盘使用情况
    shell脚本:DNS自检脚本
    Linux命令集锦:ssh命令
    Linux用户权限
    Linux文件属性
    Linux命令集锦:chown命令
    Linux命令集锦:chmod命令
    Linux命令集锦:tmux命令
  • 原文地址:https://www.cnblogs.com/liguoshuai/p/4967644.html
Copyright © 2011-2022 走看看