0
下面是我现在正在使用的,当我在GUI中测试它时,项目价格刚好从0.00更改为0.0。到目前为止,我已经尝试了至少3种不同的方法来创建对象,并使用calcPrice()方法调用它们,但目前为止没有任何成功。我所做的唯一一步就是现在GUI保持打开而不会崩溃。使用NetBeanse上的GUI生成器接口将事件处理函数调用到事件处理函数
〜让我知道你是否需要更多我的代码来评估这个。我只是复制了GUI
private void DoubleBurgerActionPerformed(java.awt.event.ActionEvent evt) {
ItemPrice.setText(String.valueOf(price));
}
public double calcPrice(boolean singleBurg, boolean doubleBurg, boolean cheese, boolean bacon, boolean meal)
{
price=0;
if (singleBurg)
{
price+=3.50;
}
if (doubleBurg)
{
price+=4.50;
}
if (cheese)
{
price+=.50;
}
if (bacon)
{
price+=1.25;
}
if (meal)
{
price+=4.00;
}
return price;
}