由命令行输入一个成绩,使用switch结构求出成绩的等级.a:90~100;b:80~89;c:
发布网友
发布时间:2022-04-23 08:54
我来回答
共2个回答
热心网友
时间:2023-10-08 23:14
public class score {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
int score = (int) (Math.random() * 101); // [0,100]
System.out.println("分数是:" + score);
score /= 10;
if (score < 6)
score = 0;
switch (score) {
case 0:
System.out.println("不及格");
break;
case 6:
System.out.println("及格");
break;
case 7:
System.out.println("良好");
break;
case 8:
System.out.println("优秀");
break;
case 9:
System.out.println("天秀");
break;
case 10:
System.out.println("蒂花之秀");
break;
default:
break;
热心网友
时间:2023-10-08 23:15
fas af