尝试将存款利息金额添加回利息标签

时间:2014-06-02 20:32:30

标签: java banking

所以我一直在尝试为我正在做的这个项目创建一个银行帐户GUI。 我遇到的问题是在尝试存款时TextField允许人们输入一定数量来添加到余额中。完成此操作后,我还希望将已存入的另一个标签存入其中,并在输入的金额之上显示利息。

这是我到目前为止所创造的

double CredAccInterest = 1;
double CurrAccInterest = 0.1;
double DepAccInterest = 3;
double SavAccInterest = 0.5;

double Deposit = Integer.parseInt(txtDeposit.getText());
double Balance = Integer.parseInt(lblSetBalance.getText());
double NewBalance = Balance + Deposit;
String NewBalWithDeposit = String.valueOf(NewBalance);
lblSetBalance.setText(NewBalWithDeposit);  

Object AccountType = cbAccounts.getSelectedItem();

String AccType = AccountType.toString();

if("Credit Account".equals(AccType))
     {
       String CurrentInterest = lblSetBalanceWithInterest.getText();
       double CurrentInterestInt = Integer.parseInt(CurrentInterest);
       double InterestAmount = Deposit * CredAccInterest;
       double NewInterestAmount = InterestAmount + CurrentInterestInt;
       String NewInterest = String.valueOf(NewInterestAmount);
       lblSetBalanceWithInterest.setText(NewInterest);
     }

0 个答案:

没有答案