天天看点

java 奖励小朋友的代码

package test;

public static void main(String[] args) {
  // TODO Auto-generated method stub

  //键盘录入小明成绩;
  Scanner sc = new Scanner(System.in);//这个警告不影响运行  后面会解释
  System.out.println("请输入小明的成绩");
  int score = sc.nextInt();
  
  //0到100合理;
  if(score>0 && score<=100) {
    //成绩不同,奖励不同。
     if(score>=95) {
       System.out.println("奖励一辆自行车");
     }else if(score>=90 && score<95) {
       System.out.println("奖励游乐园玩一天");
     }else if (score>=80 && score<90) {
       System.out.println("奖励变形金刚一个");
     }else if (score<80) {
       System.out.println("奖励七匹狼打一个小时");
     }
     
  }else {
    System.out.println("当前录入不合法");
  }
}