【Java】判断学生成绩等级
package com.company; import java.util.Scanner; public class Main { public static void main(String arg[]) { System.out.println("请输入一门成绩:"); Scanner input = new Scanner(System.in); float score = input.nextFloat(); switch ((int) score / 10) { case 10: System.out.println("成绩为A等级"); break; case 9: System.out.println("成绩为B等级"); break; case 8: System.out.println("成绩为C等级"); break; case 7: System.out.println("成绩为D等级"); break; case 6: System.out.println("成绩为E等级"); break; default: System.out.println("成绩不好,还要继续努力哦!"); } } }
本文来自博客园,作者:木子欢儿,转载请注明原文链接:https://www.cnblogs.com/HGNET/p/14584341.html