假设银行Bank已经有了按整年year计算利息的一般方法,其中year只能取正整数。如: Double computerInterest() { Interest=year*0.35*saveMon

class Bank{
int year;
double interest;
double saveMoney;
void dispoit(double money) {
saveMoney=money;
}
double computerInterest()
{
interest=year*0.35*saveMoney;
return interest;
}
}
class ConstructionBank extends Bank{
double year;
double price;
double computerInterest() {
price=(year-(int)year)*0.3*saveMoney+super.computerInterest();
return  price;
}
}

你可能感兴趣的:(假设银行Bank已经有了按整年year计算利息的一般方法,其中year只能取正整数。如: Double computerInterest() { Interest=year*0.35*saveMon)