1234567891011121314151617181920212223242526272829 |
- /*
- 小鹏参加考试,他和父亲达成承诺:
- 如果:
- 成绩为100分时,奖励一辆BMW
- 成绩为(80,99]时,奖励一部iPhone XS max
- 当成绩为[60,80]时,奖励一个iPad
- 其它时,什么奖励也没有。
- 请从键盘输入小鹏的成绩,并加以判断
- */
- import java.util.Scanner;
- class IfTest2{
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- System.out.println("请输入小鹏的考试成绩:");
- int score = scan.nextInt();
- if(score == 100){
- System.out.println("奖励一辆BMW");
- }else if(score > 80 && score <= 99){
- System.out.println("奖励一部iPhone XS max");
- }else if(score >= 60 && score <= 80){
- System.out.println("奖励一个iPad");
- }else{
- System.out.println("什么奖励也没有");
- }
- }
- }
|