public class Account {
//属性
private long id;
private double balance;
private String password;
//get/set方法
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public String getPassword() {
return null;
}
public void setPassword(String password) {
if(password.length()<6||password.length()>6)
{
System.out.println("新密码不符合规定,请重新设置");
}
else
{
this.password = password;
}
}
//构造方法
Account(){}
Account(long id,double balance,String password)
{
this.id=id;
this.balance=balance;
this.password=password;
}
Account(Account acc)
{
this.id=acc.id;
this.balance=acc.balance;
this.password=acc.password;
}
}
public class CreditAccount {
//属性:信用额度
private double creditLine;
//get/set方法
public double getCreditLine() {
return creditLine;
}
public void setCreditLine(double creditLine) {
this.creditLine = creditLine;
}
//构造方法
CreditAccount(){}
CreditAccount(double creditLine)
{
this.creditLine=creditLine;
}
CreditAccount(CreditAccount cre)
{
this.creditLine=cre.creditLine;
}
}
public class SavingAccount {
//属性:存款利率
private double interestRate;
//get/set方法
public double getInterestRate() {
return interestRate;
}
public void setInterestRate(double interestRate)
{
if(interestRate>0 && interestRate<0.1)
{
this.interestRate = interestRate;
}
else
{
System.out.println("修改的新利率不符合规定,请重新设置");
}
}
//构造方法
SavingAccount(){}
SavingAccount(double interestRate)
{
this.interestRate=interestRate;
}
SavingAccount(SavingAccount save)
{
this.interestRate=save.interestRate;
}
}