Interest is calculated using simple interest.  Simple interest is calculated using the number of days the principal balance is outstanding divided by the number of days in the year times the principal balance outstanding times the annual interest rate.  Each time the balance changes the simple interest needs to be calculated for that particular balance.