From 27ce99fd72711faa511f4978e0d3fcca2f601fa1 Mon Sep 17 00:00:00 2001 From: xuxin <840198532@qq.com> Date: Sat, 25 Apr 2026 10:42:55 +0800 Subject: [PATCH] =?UTF-8?q?day03-if=E8=AF=AD=E5=8F=A5=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day03/src/com/inmind/if01/Test04.java | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 day03/src/com/inmind/if01/Test04.java 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); + } +}