Ejemplo n.º 1
0
 @Override
 public void addFine(float fine) {
   if (fine < 0) {
     throw new RuntimeException(String.format("Member: addFine : fine cannot be negative"));
   }
   totalFines += fine;
   updateState();
 }
Ejemplo n.º 2
0
 @Override
 public void payFine(float payment) {
   if (payment < 0 || payment > totalFines) {
     throw new RuntimeException(
         String.format("Member: addFine : payment cannot be negative or greater than totalFines"));
   }
   totalFines -= payment;
   updateState();
 }
Ejemplo n.º 3
0
 public void refundLoan(ILoan loan) {
   if (fine == null) {
   } else {
     throw new RuntimeException(
         String.format("Member: refundLoan : illegal operation in state: %s", state));
   }
   totalFines -= 0;
   updateState();
 }
Ejemplo n.º 4
0
 @Override
 public void removeLoan(ILoan loan) {
   if (loan == null || !loanList.contains(loan)) {
     throw new RuntimeException(
         String.format("Member: removeLoan : loan is null or not found in loanList"));
   }
   loanList.remove(loan);
   updateState();
 }
Ejemplo n.º 5
0
 @Override
 public void addLoan(ILoan loan) {
   if (!borrowingAllowed()) {
     throw new RuntimeException(
         String.format("Member: addLoan : illegal operation in state: %s", state));
   }
   loanList.add(loan);
   updateState();
 }