public PrincipalInterestBalance Add(PrincipalInterestBalance other) { return(new PrincipalInterestBalance { Interest = this.Interest + other.Interest, Principal = this.Principal + other.Principal }); }
public CreditCard(string name, double startingBalance, double ratePerPeriod, IDiscreteInterestCalculator interestCalculator) { Name = name; _principalInterestBalance = new PrincipalInterestBalance { Principal = startingBalance, Interest = 0 }; _rate = ratePerPeriod; _interestCalculator = interestCalculator; }
public void PassTime(int periods) { _principalInterestBalance += _interestCalculator.CalculateInterest(Principal, _rate, periods); }