第四章选择结构习题5

时间:2023-02-22 21:35:24

//用switch语法做第三章的if else的练习题

package learn;

import java.util.Scanner;
public class Promise {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("请输入成绩:");
int score=input.nextInt();
switch(score/10) {
case 10:
System.out.println("奖励一辆车");
break;
case 9:
System.out.println("奖励笔记本电脑");
break;
case 8:
case 7:
case 6:
System.out.println("奖励一部手机");
break;
default:
System.out.println("没有礼物");
}
}
}