码迷,mamicode.com
首页 > 其他好文 > 详细

课后题

时间:2015-11-12 18:04:45      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:

package youliang;
import javax.swing.*;
public class DengJi {
public static void main(String args[]){
String s=new String();
int fen,n=0;
while(n==0)
{
try{
s=JOptionPane.showInputDialog("请输入分数:");
fen=Integer.parseInt(s);
if(fen>0&&fen<60)
{JOptionPane.showMessageDialog(null, "不及格!");n=1;}
if(fen>60&&fen<=70)
{JOptionPane.showMessageDialog(null, "及格!");n=1;}
if(fen>70&&fen<80)
{JOptionPane.showMessageDialog(null, "中!");n=1;}
if(fen>80&&fen<90)
{JOptionPane.showMessageDialog(null, "良!");n=1;}
if(fen>90&&fen<=100)
{JOptionPane.showMessageDialog(null, "优!");n=1;}
if(fen<0||fen>100)
{JOptionPane.showMessageDialog(null, "请按要求输入分数!");}

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "输入错误,请重新输入:");
}
finally
{
System.out.println("执行finally!");
}
}
}
}

技术分享

技术分享

 

 

 

技术分享

技术分享

 

课后题

标签:

原文地址:http://www.cnblogs.com/liying123/p/4959451.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!