码迷,mamicode.com
首页 > 编程语言 > 详细

java课后作业2----

时间:2017-11-16 21:59:15      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:ack   技术分享   ext   out   es2017   异常处理   not   images   ring   

编写一个程序,此程序在运行要求用户输入一个整数,代表某门课的考试成绩,程序接着给出“不及格”、“及格”、“中”、“良”、“优”的结论

源程序:

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("优");
}
}

}

程序截图:

技术分享

 

java课后作业2----

标签:ack   技术分享   ext   out   es2017   异常处理   not   images   ring   

原文地址:http://www.cnblogs.com/lovema1210/p/7846267.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!