java编程,用switch语句编写一个学生成绩等级评定,使用键盘读取分数(0-100之间)学生成
java编程,用switch语句编写一个学生成绩等级评定,使用键盘读取分数(0-100之间)学生成绩为百分制,而成绩分为ABCDE五个字母表示,90以上A,80-89B,...
java编程,用switch语句编写一个学生成绩等级评定,使用键盘读取分数(0-100之间)学生成绩为百分制,而成绩分为ABCDE五个字母表示,90以上A,80-89B,70-79C,60-69D,60以下E。
展开
展开全部
public class Grade {
public static void main(String[] args) {
带亩 Scanner scanner = new Scanner(System.in);
int grade = scanner.nextInt();
switch (grade/10){
册陪 case 10:
case 9:
System.out.println("成绩:"+grade+"\t 等级 "+"A");
州行蠢 break;
case 8:
System.out.println("成绩:"+grade+"\t 等级 "+"B");
break;
case 7:
System.out.println("成绩:"+grade+"\t 等级 "+"C");
break;
case 6:
System.out.println("成绩:"+grade+"\t 等级 "+"D");
break;
default:
System.out.println("成绩:"+grade+"\t 等级 "+"E");
break;
}
}
}
展开全部
import 码橘帆java.util.Scanner;
public class GetGrade {
public static 伍液void main(String[] args) {
System.out.println("请输入成绩(1-100)");
Scanner sc = new Scanner(System.in);
int score = sc.nextInt();
if (score < 0 || score > 100) {
System.out.println("对不起,你输入有误");
return;
}
System.out.println("你迟雹获得了:"+getGrade(score));
}
public static String getGrade(int i) {
String ret = null;
switch (i / 10) {
case 10:
ret = "A";
break;
case 9:
ret = "A";
break;
case 8:
ret = "B";
break;
case 7:
ret = "C";
break;
case 6:
ret = "D";
break;
default:
ret = "E";
break;
}
return ret;
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
import java.util.Scanner;
public class fenshu {
public static void main(String[] args) {
//TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int mark=sc.nextInt();
switch(mark/10)
{
case 10:
case 9: System.out.print("闹伏宏A");break;
case 8: System.out.print("B");break;
case 7: System.out.print("液册C"厅弯);break;
case 6: System.out.print("D");break;
default:System.out.print("E");
}
}
}
public class fenshu {
public static void main(String[] args) {
//TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int mark=sc.nextInt();
switch(mark/10)
{
case 10:
case 9: System.out.print("闹伏宏A");break;
case 8: System.out.print("B");break;
case 7: System.out.print("液册C"厅弯);break;
case 6: System.out.print("D");break;
default:System.out.print("E");
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public static void main(String[] args) {
Scanner sn = new Scanner(System.in);
System.out.print("请输入百做卖分制的分数:");
while (sn.hasNext()) {
String scStr = sn.next();
int sc = 0;
try {
sc = Integer.valueOf(scStr);
} catch (Exception e) {
System.out.print("请输入弯冲百分制的分数:");
continue;
}
if (sc < 0 || sc > 100) {
System.out.print("请输入百分制的分数:");
continue;
}
int s = sc / 10;
switch (s) {
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;
default:
System.out.println("E");
break;
}
System.out.print("请输入百分制的分数:");
}
}
Scanner sn = new Scanner(System.in);
System.out.print("请输入百做卖分制的分数:");
while (sn.hasNext()) {
String scStr = sn.next();
int sc = 0;
try {
sc = Integer.valueOf(scStr);
} catch (Exception e) {
System.out.print("请输入弯冲百分制的分数:");
continue;
}
if (sc < 0 || sc > 100) {
System.out.print("请输入百分制的分数:");
continue;
}
int s = sc / 10;
switch (s) {
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;
default:
System.out.println("E");
break;
}
System.out.print("请输入百分制的分数:");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个是最最初级的东西,如果这个不会就没必要写开发了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询