课后题

时间:2015-11-12 18:03:49   收藏:0   阅读:283

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
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!