RuoYi/IfDemo1.java

18 lines
875 B
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

public class IfDemo1 {
public static void main(String[] args) {
// 格式3 if(条件表达式){ 代码... } else if(条件表达式){ 代码... } ... else{ 代码... }
int score = 95;
// 绩效0-60 C60-80 B80-90 A90-100 A+
if (score >= 0 && score < 60) {
System.out.println("分数是:" + score + "绩效是C");
} else if (score >= 60 && score < 80) {
System.out.println("分数是:" + score + "绩效是B");
} else if (score >= 80 && score < 90) {
System.out.println("分数是:" + score + "绩效是A");
} else if (score >= 90 && score <= 100) {
System.out.println("分数是:" + score + "绩效是A+");
} else {
System.out.println("录入的分数有毛病!");
}
}
}