编写一个程序,此程序在运行要求用户输入一个整数,代表某门课的考试成绩,程序接着给出“不及格”、“及格”、“中”、“良”、“优”的结论
源程序:
package 异常处理;
import java.io.FileNotFoundException;import java.util.Scanner;
public class Score { public static void main(String[] args) throws FileNotFoundException{ // TODO Auto-generated method stub System.out.println("请输入一个该门课的城际:"); Scanner scanner=new Scanner(System.in); int score=scanner.nextInt(); if(score>=0&&score<60) { System.out.println("不及格"); } if(score>=60&&score<70) { System.out.println("及格"); } if(score>=70&&score<80) { System.out.println("中等"); } if(score>=80&&score<90) { System.out.println("良"); } if(score>=90&&score<=100) { System.out.println("优"); } }
}
程序截图:
转载于:https://www.cnblogs.com/lovema1210/p/7846267.html
相关资源:JAVA上百实例源码以及开源项目