private double CalculateProportionalBalance(int dayOfLatestBalance, int balance, int day, int daysInMonth) { int countingDays = day - dayOfLatestBalance; if (countingDays == 0) { return 0; } double rate = (double)countingDays / daysInMonth; return (balance * rate); }