开关式评定成绩等级
作者:互联网
package net.xmh.lesson05;
import java.util.Scanner;
/**
-
功能:开关式评定成绩等级
-
作者:xiangminghan
-
日期:2019年4月4日
*/
public class JudgeScoreLevelSwitch{
public static void main(String[] args) {
//声明部分
double score;
String level;
Scanner sc = new Scanner(System.in);
//输入部分
System.out.print("score = ");
score = sc.nextDouble();
//处理部分
level = “”;
if (score >100||score <0){
level = “超出范围”;}
else{
switch ((int)score/10){
case 10:
case 9:
level = “优秀”;
break;
case 8:
level = “良好”;
break;
case 7:
level = “中等”;
break;
case 6:
level = “及格”;
break;
default:
level = “不及格”;} } //输入部分 System.out.println("level = " + level); }
}
标签:case,Scanner,level,System,break,开关,score,评定,等级 来源: https://blog.csdn.net/xiangminghan/article/details/89040458