初学者问题跪求大仙解答
//JAVA大学教程2.12 开发一个JAVA applet,确定一个商店的客户是否已超过其信用卡透支数
客户提供的信息:帐号,本月初余额,该客户所购置所有商品总额,本月该客户账号中的存款总额,允许的信用卡限额
下面是我编写的一个程序,现在我想输入的是浮点型的数据,但是老报错,求大仙指教,我是初学者
import java.awt.*;
import java.applet.Applet;
public class Creditcard extends Applet{
Label prompt1,prompt2,prompt3,prompt4,prompt5;
TextField input1,input2,input3,input4,input5;
double count,left_money,gift_sum,deposit_sum,credit_limit,new_left;
public void init()
{
prompt1 = new Label("enter your count number:");
input1 = new TextField(10);
prompt2 = new Label("enter your count left money:");
input2 = new TextField(10);
prompt3 = new Label("enter your total gift cost:");
input3 = new TextField(10);
prompt4 = new Label("enter your deposit:");
input4 = new TextField(10);
prompt5 = new Label("enter your credit limit:");
input5 = new TextField(10);
add(prompt1);
add(input1);
add(prompt2);
add(input2);
add(prompt3);
add(input3);
add(prompt4);
add(input4);
add(prompt5);
add(input5);
}
public void paint(Graphics g)
{
g.drawString("the new left money is:"+new_left,100,180);
if(new_left>credit_limit)
g.drawString("Credit limit exceeded", 100, 200);
}
public boolean action(Event event,Object o)
{
if(event.target==input5)
{
count = Integer.parseInt(input1.getText());
left_money = Integer.parseInt(input2.getText());
gift_sum = Integer.parseInt(input3.getText());
deposit_sum = Integer.parseInt(input4.getText());
credit_limit = Integer.parseInt(input5.getText());
new_left = -left_money+gift_sum-deposit_sum;
repaint();
}
return true;
}
}