public abstract class BankBase {
private int money;
private int accountNum;
private int startYear;
private static int currentYear;
public BankBase(int accountNum) {
this.accountNum = accountNum;
currentYear = startYear;
}
public BankBase(int money, int accountNum) {
this.money = money;
this.accountNum = accountNum;
currentYear = startYear;
}
public void depositMoney(int deposit) {
this.money += deposit;
}
public void paimentMoney(int payment) {
if(this.money < payment) {
System.
err.
println("預金額より多い出金をしようとしています."); return;
}
this.money -= payment;
}
public int getMoney() { return money; }
public int getAccountNum() { return accountNum; }
public int getStartYear() { return startYear; }
public void setStartYear(int startYear) { this.startYear = startYear; }
public static void setCurrentYear(int Year) { currentYear = Year; }
public static int getCurrentYear() { return currentYear; }
public abstract void addInterest();
}
cHVibGljIGFic3RyYWN0IGNsYXNzIEJhbmtCYXNlIHsKICAgIHByaXZhdGUgaW50IG1vbmV5OwogICAgcHJpdmF0ZSBpbnQgYWNjb3VudE51bTsKICAgIHByaXZhdGUgaW50IHN0YXJ0WWVhcjsKICAgIHByaXZhdGUgc3RhdGljIGludCBjdXJyZW50WWVhcjsKICAgIHB1YmxpYyBCYW5rQmFzZShpbnQgYWNjb3VudE51bSkgewogICAgICAgIHRoaXMuYWNjb3VudE51bSA9IGFjY291bnROdW07CiAgICAgICAgY3VycmVudFllYXIgPSBzdGFydFllYXI7CiAgICB9CiAgICBwdWJsaWMgQmFua0Jhc2UoaW50IG1vbmV5LCBpbnQgYWNjb3VudE51bSkgewogICAgICAgIHRoaXMubW9uZXkgPSBtb25leTsKICAgICAgICB0aGlzLmFjY291bnROdW0gPSBhY2NvdW50TnVtOwogICAgICAgIGN1cnJlbnRZZWFyID0gc3RhcnRZZWFyOwogICAgfQogICAgcHVibGljIHZvaWQgZGVwb3NpdE1vbmV5KGludCBkZXBvc2l0KSB7CiAgICAgICAgdGhpcy5tb25leSArPSBkZXBvc2l0OwogICAgfQogICAgcHVibGljIHZvaWQgcGFpbWVudE1vbmV5KGludCBwYXltZW50KSB7CiAgICAgICAgaWYodGhpcy5tb25leSA8IHBheW1lbnQpIHsKICAgICAgICAgICAgU3lzdGVtLmVyci5wcmludGxuKCLpoJDph5HpoY3jgojjgorlpJrjgYTlh7rph5HjgpLjgZfjgojjgYbjgajjgZfjgabjgYTjgb7jgZkuIik7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgdGhpcy5tb25leSAtPSBwYXltZW50OwogICAgfQogICAgcHVibGljIGludCBnZXRNb25leSgpIHsgcmV0dXJuIG1vbmV5OyB9CiAgICBwdWJsaWMgaW50IGdldEFjY291bnROdW0oKSB7IHJldHVybiBhY2NvdW50TnVtOyB9CiAgICBwdWJsaWMgaW50IGdldFN0YXJ0WWVhcigpIHsgcmV0dXJuIHN0YXJ0WWVhcjsgfQogICAgcHVibGljIHZvaWQgc2V0U3RhcnRZZWFyKGludCBzdGFydFllYXIpIHsgdGhpcy5zdGFydFllYXIgPSBzdGFydFllYXI7IH0KICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBzZXRDdXJyZW50WWVhcihpbnQgWWVhcikgeyBjdXJyZW50WWVhciA9IFllYXI7IH0KICAgIHB1YmxpYyBzdGF0aWMgaW50IGdldEN1cnJlbnRZZWFyKCkgeyByZXR1cm4gY3VycmVudFllYXI7IH0KICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIGFkZEludGVyZXN0KCk7Cn0=