初学者问题跪求大仙解答
//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;
}
}
客户提供的信息:帐号,本月初余额,该客户所购置所有商品总额,本月该客户账号中的存款总额,允许的信用卡限额
下面是我编写的一个程序,现在我想输入的是浮点型的数据,但是老报错,求大仙指教,我是初学者
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;
}
}
...全文
相关推荐
实训商业源码-大仙工作室美化版-论文模板.zip
实训商业源码-大仙工作室美化版-论文模板.zip
黄大仙祠导游词.doc
黄大仙祠导游词.doc
西游记选择题和答案解析.doc
西游记选择题和答案解析.doc
国央企创新负责人如何通过平台实现科研成果的快速识别与转化?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
PotPlayer自用皮肤
自用 PotPlayer 皮肤,仅微调了字体大小与颜色,是按个人习惯调整,未做适配性调整。


非技术区

