Пример #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();
 }
Пример #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();
 }
Пример #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();
 }
Пример #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();
 }
Пример #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();
 }