// Gernal Override public override string ToString() => $"Amount: {Amount} \n" + $"Rate: {Rate} \n" + $"Installments Left: {InstallmentsLeft} \n" + $"DateIssued: {DateIssued.ToLongDateString()} \n" + $"DateExpire: {DateExpire.ToLongDateString()} \n" + $"InstallmentsLeft: {InstallmentsLeft} \n" + $"Days: {Days}\n";
// Processes The loan // returns the status after processsing public void Process(Account account) { { bool result = false; string reason = ""; // Checks if the account already has a loan. if (!account.HasLoan) { // Verification Check if (!(TUI.ReadInteger("Please Enter Your unique accountID for verification: ") == account.AccountID)) { reason = "Verification Error"; } else { // Checks the initial Balance Before Giving Loan. if (account.Balance > Amount) { // Asks For all the details Amount = TUI.ReadDecimal("Please Enter What amount of loan would you like : "); Days = TUI.ReadInteger("For How many Days: "); Rate = TUI.ReadInteger("The intrest rate from the chart: "); Installments = TUI.ReadIntegerRange(3, 10, "How many installments would you like? (3-10): "); AmountPerInstallment = ((Rate * Days) + Amount) / Installments; account.Balance += Amount; account.HasLoan = true; DateIssued = DateTime.Now; InstallmentsLeft = Installments; LateCharge = TUI.ReadDecimal("Please Enter the Late Charge displayed on the chart."); Console.WriteLine("Loan Successfully Initiated!"); Console.WriteLine($"This is your balance now {account.Balance:C}"); Console.WriteLine($"The Loan is due on: {DateExpire.ToShortDateString()}"); result = true; } else { reason = "Low Balance"; Console.WriteLine($"This is your balance {account.Balance:C}"); Console.WriteLine($"This is your amount {Amount:C}"); } } } else { reason = "Loan Already Issued"; } if (!(result && reason == "")) { Console.WriteLine($"Loan Couldn't be processed please try again, reason: {reason}."); } } }