银行账户Java GUI

时间:2015-09-03 10:12:08

标签: java class user-interface

我需要为gui应用程序创建一个withdraw方法,不知道我需要怎么做。 到目前为止我已经

    package ATM;



   Account a1 = new Account(0001, 1000.00, 7.5);
   private void    `enter code here`holderWithdrawActionPerformed(java.awt.event.ActionEvent    evt) {                                               
    // TODO add your handling code here:

   double withdrawAmountEntry = Double.parseDouble(holderEntryField.getText());
     a1.setWithdrawAmount(withdrawAmountEntry); 
     Account.withdraw();

}                                              

这是我的帐户类,包含该方法。

    package ATM;

import java.util.Date;



public class Account {
private int id;
private double balance;
private double annualInterestRate;
private double withdrawAmount;


Account(int id, double balance, double annualInterestRate){
    this.id=id;
    this.balance=balance;
    this.annualInterestRate=annualInterestRate;
    this.withdrawAmount= withdrawAmount;
}

 Account(){
    id = 0001;
    balance = 1000.00;

 }
/**
 * @return the id
 */
public int getId() {
    return id;
}

/**
 * @param id the id to set
 */
public void setId(int id) {
    this.id = id;
}

/**
 * @return the balance
 */
public double getBalance() {
    return balance;
}

/**
 * @param balance the balance to set
 */
public void setBalance(double balance) {
    this.balance = balance;
}

/**
 * @return the annualInterestRate
 */
public double getAnnualInterestRate() {
    return annualInterestRate;
}

/**
 * @param annualInterestRate the annualInterestRate to set
 */
public void setAnnualInterestRate(double annualInterestRate) {
    this.annualInterestRate = annualInterestRate;
}




/**
 * @return the withdrawAmount
 */
public double getWithdrawAmount() {
    return withdrawAmount;
}

/**
 * @param withdrawAmount the withdrawAmount to set
 */
public void setWithdrawAmount(double withdrawAmount) {
    this.withdrawAmount = withdrawAmount;
}
/**
 * @return the date
 */

/**
 *
 * @param withdrawAmount
 * @param balance
 * @return the date
 */
public double withdraw(double withdrawAmount, double balance ){
    return balance - withdrawAmount;

}

}

这是调用方法的正确方法吗?如果是这样,为什么我有 "类中撤销方法帐户不能应用于给定类型;   要求:双倍,双倍   发现:没有争论   原因:实际和正式的参数列表长度不同""

0 个答案:

没有答案