diff --git a/day03/src/com/inmind/if01/Test04.java b/day03/src/com/inmind/if01/Test04.java new file mode 100644 index 0000000..842b5f1 --- /dev/null +++ b/day03/src/com/inmind/if01/Test04.java @@ -0,0 +1,32 @@ +package com.inmind.if01; +/* +指定考试成绩,判断学生等级 +90-100 优秀 +80-89 好 +70-79 良 +60-69 及格 +60以下 不及格 + */ +public class Test04 { + public static void main(String[] args) { + //定义成绩 + int score = 50; + String result; + + //多条件判断,得出结果 + //ctrl+D:复制当行内容 + if (score >= 90 && score <= 100) { + result = "优秀"; + } else if (score >= 80 && score <= 89) { + result = "好"; + }else if (score >= 70 && score <= 79) { + result = "良好"; + } else if (score >= 60 && score <= 69) { + result = "及格"; + } else { + result = "不及格"; + } + + System.out.println("当前成绩为:"+result); + } +}