package com.hanqi; import java.util.*; public class xuexichengji { public static void main(String[] args) { // TODO 自动生成的方法存根 System.out.println("输入姓名"); Scanner xingming = new Scanner(System.in); String ren = xingming.next(); System.out.println("输入成绩"); while (true) { Scanner chengji = new Scanner(System.in); Double shu = chengji.nextDouble(); if (shu > 100 || shu < 0) { System.out.println("输入的成绩有误"); continue; } else { if (shu >= 90) { System.out.println(ren+"的成绩为A"); break; } else if (shu < 60) { System.out.println(ren+"的成绩为C"); break; } else { System.out.println(ren+"的成绩为B"); break; } } } } }