Package account

Class AccountImplDebitV4J

java.lang.Object
account.AccountImplDebitV4J

public class AccountImplDebitV4J
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    AccountImplDebitV4J​(double amount, java.lang.String owner, int min)  
  • Method Summary

    Modifier and Type Method Description
    double balance()  
    boolean containsTA​(account.Transaction t)  
    void credit​(double amount)  
    void debit​(double amount, java.time.LocalDate date)
    debits an account
    void debit2​(double amount, java.time.LocalDate date)  
    void debitOrg​(int amount)  
    java.lang.String getHolder()  
    boolean invariant()  
    int overdraft()  
    void setHolder​(java.lang.String newHolder)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AccountImplDebitV4J

      public AccountImplDebitV4J​(double amount, java.lang.String owner, int min) throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
  • Method Details

    • balance

      public double balance()
    • containsTA

      public boolean containsTA​(account.Transaction t)
    • credit

      public void credit​(double amount) throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
    • debitOrg

      public void debitOrg​(int amount) throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
    • debit2

      public void debit2​(double amount, java.time.LocalDate date) throws org.valid4j.errors.RequireViolation
      Throws:
      org.valid4j.errors.RequireViolation
    • debit

      public void debit​(double amount, java.time.LocalDate date) throws org.valid4j.errors.ContractViolation
      debits an account
      Parameters:
      amount - the amount to be debited from the account
      date - booking date
      Throws:
      org.valid4j.errors.ContractViolation - if the contract is violated
      Precondition:
      amount must be positive AND account must be funded AND date is in the future
      Postcondition:
      a debit transaction is stored AND balance is reduced by amount
    • getHolder

      public java.lang.String getHolder() throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
    • setHolder

      public void setHolder​(java.lang.String newHolder) throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
    • overdraft

      public int overdraft() throws org.valid4j.errors.ContractViolation
      Throws:
      org.valid4j.errors.ContractViolation
    • invariant

      public boolean invariant()