Java并列式评定等级成绩

JudgeScoreLv.java
1 package nrt.hw.lesson04;
2
3 import java.util.Scanner;
4
5 /**
6 * 功能:并列式评定等级成绩
7 * 作者:王梨花
8 * 日期:2019年3月21日
9 */
10
11
12 public class JudgeScoreLv {
13 public static void main(String[] args) {
14 //声明部分
15 double score;
16 String level;
17 Scanner sc = new Scanner(System.in);
18
19 //输入部分
20 System.out.println("score = ");
21 score = sc.nextDouble();
22
23 //处理部分
24 level = “”;
25 if (score > 100){
26 level = “超出范围”;
27 }
28 if (score >=90 && score <= 100){
29 level = “优秀”;
30 }
31 if (score >=80 && score <90){
32 level = “良好”;
33 }
34 if (score >=70 && score <80) {
35 level = “中等”;
36 }
37 if (score >=60 && score <70) {
38 level = “及格”;
39 }
40 if (score >=0 && score <60) {
41 level = “不及格”;
42 }
43 if ( score <0) {
44 level = “超出范围”;
45 }
46 //输出部分
47 System.out.println("level = " + level);
48
49 }
50 }
51

猜你喜欢

转载自blog.csdn.net/Panic_weaver/article/details/88710302