Deposite()
会将金额与余额相加。 Withdraw()
将从余额中扣除金额。 GetBalance()
将退还余额。 GetInterest()
将通过计算余额*(interest / 100)
class BankAccount
{
public string accountName;
public int accountBalance;
public int accountNumber;
public BankAccount(string name, int number)
{
accountName = name;
accountNumber = number;
}
public int getAccountNumber()
{
return accountNumber;
}
public void setAccountNumber(int newNumber)
{
accountNumber = newNumber;
}
}
答案 0 :(得分:0)
我认为您需要这个......
class BankAccount
{
public string accountName;
public int accountBalance;
public int accountNumber;
public BankAccount(string name, int number)
{
accountName = name;
accountNumber = number;
}
public int getAccountNumber()
{
return accountNumber;
}
public void setAccountNumber(int newNumber)
{
accountNumber = newNumber;
}
public void Deposite(int dep)
{
this.accountBalance = accountBalance + dep;
}
public void Withdraw(int dep)
{
this.accountBalance = accountBalance - dep;
}
public int GetBalance()
{
return this.accountBalance;
}
public double GetInterest(int interest)
{
double val = this.accountBalance * (interest / 100);
return val;
}
}