mmayoub

Bank, Student class (account type)

Aug 10th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. package BankAccounts;
  2.  
  3. import java.time.LocalDate;
  4.  
  5. import BankClients.Client;
  6. import BankPkg.AccountType;
  7.  
  8. public class Student extends LoanableAccount {
  9.  
  10.     public Student(String name, int personId, LocalDate birthDate)
  11.             throws Exception {
  12.         this(new Client(name, personId, birthDate));
  13.     }
  14.  
  15.     public Student(Client owner) throws Exception {
  16.         super(owner, AccountType.student);
  17.     }
  18.  
  19.     public Student(Student other) {
  20.         super(other);
  21.     }
  22.  
  23.     public boolean returnLoan() {
  24.         double loanWithFee = this.loanAmount + this.calcFee(this.loanAmount);
  25.         if (this.accountBalance >= loanWithFee) {
  26.             this.accountBalance -= loanWithFee;
  27.             this.loanAmount = 0;
  28.             this.payments = 0;
  29.  
  30.             return true;
  31.         }
  32.         return false;
  33.     }
  34. }
Add Comment
Please, Sign In to add comment