fork download
  1. import static java.lang.Math.*;
  2.  
  3. public class TBank extends BankBase {
  4. private static int accountManageNum = 6000;
  5. private static double rate;
  6. private int due;
  7. public TBank(int due) {
  8. super(0, accountManageNum);
  9. accountManageNum += 10;
  10. this.due = due;
  11. }
  12. public TBank(int money, int due) {
  13. super(money, accountManageNum);
  14. accountManageNum += 10;
  15. this.due = due;
  16. }
  17. public void addInterest() {
  18. if(getCurrentYear() - getStartYear() >= due) {
  19. System.out.println(getMoney() + (int)((getMoney() * (pow(1 + rate/100.d, due) - 1))));
  20. } else {
  21. System.out.println(getMoney());
  22. }
  23. }
  24. public static void setRate(double _rate) { rate = _rate; }
  25. public static double getRate() { return rate; }
  26. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty