首页 > 编程 > Java > 正文

java实现——2004成绩转换

2019-11-06 06:26:07
字体:
来源:转载
供稿:网友
import java.util.Scanner;public class Main{		public static void main(String args[]){		int score;		Scanner scan = new Scanner(System.in);		while(scan.hasNext()){			score = scan.nextInt();			if(score > 100 || score <0){				System.out.PRintln("Score is error!");			}			else			{				int n = score/10;				switch(n)				{					case 10:					case 9:						System.out.println('A');						break;					case 8:						System.out.println('B');						break;					case 7:						System.out.println('C');						break;					case 6:						System.out.println('D');						break;					case 5:					case 4:					case 3:					case 2:					case 1:					case 0:						System.out.println('E');						break;				}			}		}	}}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表