首页 > 其他 > 详细

课后作业

时间:2015-11-15 23:03:07      阅读:238      评论:0      收藏:0      [点我收藏+]

程序源代码:

package 课后作业;
import javax.swing.JOptionPane;
public class 课后作业 {
static String judge(int m)
{
String output="";
if(m<60)
{
output += "不及格";
}
if(m<70&&m>=60)
{
output +="及格";
}
if(m<80&&m>=70)
{
output +="良好";
}
if(m<90&&m>=80)
{
output +="中";
}
if(m<100&&m>=90)
{
output +="优秀";
}
return output;
}
public static void main(String[] args){
while(true)
{
try{
int m = 0;
String str=JOptionPane.showInputDialog("输入成绩");
m=Integer.parseInt(str);

if(m<0||m>100)
throw new Exception();

JOptionPane.showConfirmDialog(null,judge(m));
System.exit(0);

}
catch(Exception e)
{
JOptionPane.showConfirmDialog(null,"对不起,您输入的姿势不对,请重新输入");
}

}
}
}

程序结果截图:技术分享

课后作业

原文:http://www.cnblogs.com/lvzaiyang/p/4967578.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!