public string Format(Account account) { if (account.Balance < 0) { return string.Format($"{account.GetType().Name} >>>>> {Environment.NewLine}" + $"Overdraft: {account.Balance}{Environment.NewLine}" + $"Montly interest rate: {account.MonthlyInterestRate} {Environment.NewLine}" + $"Interest rate for 24 months: {account.InterestRate(24)}{Environment.NewLine}"); } return string.Format($"{account.GetType().Name} >>>>> {Environment.NewLine}" + $"Balance: {account.Balance}{Environment.NewLine}" + $"Montly interest rate: {account.MonthlyInterestRate} {Environment.NewLine}" + $"Interest rate for 24 months: {account.InterestRate(24)}{Environment.NewLine}"); }
public void Print(Account account, BasicAccountPrint formatter) { var result = formatter.Format(account); Console.WriteLine(result); }