我做了一下,看看能不能给你一点帮助:- package com.test;
- import java.util.Scanner;
- public class Test
- {
- public static void main (String[] args)
- {
- Scanner scan = new Scanner(System.in);
- System.out.println("请输入分值0-100:");
- int score = scan.nextInt();
- switch(score/10)
- {
- case 10:
- case 9:
- System.out.println("成绩为优秀");
- break;
- case 8:
- System.out.println("成绩为良");
- break;
- case 7:
- case 6:
- System.out.println("成绩为中");
- break;
- default :
- System.out.println("成绩为差");
- }
-
- }
- }
复制代码 |