Package job

Class InterestCalculationJob

java.lang.Object
job.InterestCalculationJob
All Implemented Interfaces:
BankingJob

public class InterestCalculationJob extends Object implements BankingJob
Background job that calculates and credits monthly interest to savings accounts. Runs automatically when Web application starts.
Author:
TAMIL MUGHILAN
  • Field Details

    • logger

      private static final Logger logger
    • ANNUAL_INTEREST_RATE

      private static final BigDecimal ANNUAL_INTEREST_RATE
    • MONTHS_IN_YEAR

      private static final BigDecimal MONTHS_IN_YEAR
    • dataStorage

      private final DataStorage dataStorage
  • Constructor Details

    • InterestCalculationJob

      public InterestCalculationJob(DataStorage dataStorage)
      Creates Interest Calculation Job
      Parameters:
      dataStorage - the data storage to access DB
  • Method Details

    • execute

      public void execute()
      Executes the interest calculation for all savings accounts. Processes accounts from all branches and credits monthly interest.
      Specified by:
      execute in interface BankingJob
    • calculateAndCreditInterest

      private BigDecimal calculateAndCreditInterest(SavingsAccount account)
      Calculates and credits interest to a single account.
      Parameters:
      account - the savings account to process
      Returns:
      the amount of interest credited
    • getJobName

      public String getJobName()
      Gets the name of this job.
      Specified by:
      getJobName in interface BankingJob
      Returns:
      the job name
    • getJobDescription

      public String getJobDescription()
      Gets the description of what this job does.
      Specified by:
      getJobDescription in interface BankingJob
      Returns:
      the job description