求这个JAVA题怎么做?

来源:百度知道 编辑:UC知道 时间:2024/06/04 19:15:15
1. 建一个银行账户类BankAccount
2. 该类的数据成员包括:(1)户名m_sName(String);(2)账户金额m_dBalance;(3)年利率m_dInterestRate
3. 该类的成员函数包括:(1)构造函数BankAccount,设置户名、账户金额、利率的初始值,构造函数重载;(2)函数getBalance,获取当前账户金额;(3)函数getInterestRate,获取当前利率;(4)函数setInterestRate,设定当前利率;(5)函数PrintAccountMeg,打印当前账户信息;(6)函数saveMoney,存款操作;(7)函数getMoney,取款操作;(8)函数caculateInterest(int Days),按当前利率当前存款计算给定天数所得利息。
4. 建应用函数类SimpleAccount
5. 在应用函数类的main函数中完成以下操作(1)建一个BankAccount类的对象;(2)打印账户信息;(3)存入一笔钱;(4)打印账户信息;(5)取出一笔钱;(6)打印账户信息;(7)计算十年后的银行存款额并打印;(8)改变利率后计算十年后的银行存款额并打印。

这个问题不难吧,学程序要勤动手
package test;

class BankAccount {
private String m_sName;
private double m_dBalance;
private double m_dInterestRate;
//private BankAccount b;
BankAccount(String m_sName,double m_dBalance,double m_dInterestRate){
this.m_sName = m_sName;
this.m_dBalance = m_dBalance;
this.m_dInterestRate = m_dInterestRate;
}
double getBalance(){
return m_dBalance;
}
double getInterestRate(){
return m_dInterestRate;
}
void setInterestRate(double m_dInterestRate){
this.m_dInterestRate = m_dInterestRate;
}
void PrintAccountMeg(){
System.out.println("户名"+m_sName+"账户金额"+m_dBalance);
}
void saveMoney(double m_dBalance){
this.m_dBalance+=m_dBalance;
System.out.println("户名"+m_sName+"账户金额"+this.m_dBalance);
}
void getMoney(double m_dBalance){
if(m_dBalance<this.m_dBa