public virtual string CloseAndReport() { CurrentBalance -= serviceCharge; CalculateInterest(); StringBuilder accountInfo = new StringBuilder(); accountInfo.AppendLine("Previous Balance: " + ToNamFormat.ToNAMoneyFormat(true, StartingBalance) + "$"); accountInfo.AppendLine("New Balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); accountInfo.AppendLine("Percent change: " + ToNamFormat.ToNAMoneyFormat(true, GetPercentageChange()) + "%"); accountInfo.AppendLine("Monthly interest rate: " + ToNamFormat.ToNAMoneyFormat(true, monthlyInterestRate) + "%"); accountInfo.AppendLine("Monthly interest: " + ToNamFormat.ToNAMoneyFormat(true, monthlyInterest) + "$"); accountInfo.AppendLine("Service charge: " + ToNamFormat.ToNAMoneyFormat(true, serviceCharge)); accountInfo.AppendLine("Current balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); withdrawalCount = 0; depositCount = 0; serviceCharge = 0; return(accountInfo.ToString()); }
public override void MakeWithdraw(double amount) { if (status == Status.active && CurrentBalance < 25) { status = Status.inactive; Console.WriteLine("The account is inactive and currently has less than 25$"); Console.WriteLine("Current balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); } else { base.MakeWithdraw(amount); Console.WriteLine("You have withdrawn: " + ToNamFormat.ToNAMoneyFormat(true, amount) + "$"); Console.WriteLine("Current balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); } }
public override void MakeWithdraw(double amount) { if (CurrentBalance - amount < 0) { serviceCharge += 15; Console.WriteLine("Withdrawal denied, not enough money in your current balance"); Console.WriteLine("15$ has been added to your monthly charge fee"); } else { base.MakeWithdraw(amount); Console.WriteLine("You have withdrawn: " + amount); Console.WriteLine("Curent balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); } }
public override void MakeDeposit(double amount) { if (status == Status.inactive && (CurrentBalance + amount) >= 25) { base.MakeDeposit(amount); Console.WriteLine("You have deposited: " + ToNamFormat.ToNAMoneyFormat(true, amount) + "$"); Console.WriteLine("Curent balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); status = Status.active; } else { base.MakeDeposit(amount); Console.WriteLine("You have deposited: " + ToNamFormat.ToNAMoneyFormat(true, amount) + "$"); Console.WriteLine("Curent balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); } }
public static void GlobalMenu() { GlobalSavingsAccount global = new GlobalSavingsAccount(5.00, 0.03); ShowGlobalSavingsAccountMenu(); bool exit = false; try { do { string input = Console.ReadLine(); switch (input.ToUpper()) { case "A": Console.WriteLine("--------------------------------------------"); Console.WriteLine("How much do you want to deposit?"); string a; double depositAmount; a = Console.ReadLine(); while (!double.TryParse(a, out depositAmount)) { Console.WriteLine("Please enter a number"); a = Console.ReadLine(); } global.MakeDeposit(depositAmount); ShowGlobalSavingsAccountMenu(); break; case "B": Console.WriteLine("--------------------------------------------"); Console.WriteLine("How much do you want to withdraw?"); string b = Console.ReadLine(); double withdrawAmount; while (!double.TryParse(b, out withdrawAmount)) { Console.WriteLine("Please enter a number"); b = Console.ReadLine(); } global.MakeWithdraw(withdrawAmount); ShowGlobalSavingsAccountMenu(); break; case "C": Console.WriteLine("--------------------------------------------"); Console.Write(global.CloseAndReport()); Console.WriteLine("\nPress enter to continue"); Console.ReadLine(); ShowGlobalSavingsAccountMenu(); break; case "D": Console.WriteLine("--------------------------------------------"); Console.WriteLine("Balance in USD " + ToNamFormat.ToNAMoneyFormat(true, global.USValue(0.76)) + "$"); ShowGlobalSavingsAccountMenu(); break; case "R": MainMenu(); break; default: Console.WriteLine("--------------------------------------------"); Console.WriteLine("Please select a valid option: "); ShowGlobalSavingsAccountMenu(); break; } } while (exit == false); } catch (Exception) { Console.WriteLine("Error, try again"); } }
public override void MakeDeposit(double amount) { base.MakeDeposit(amount); Console.WriteLine("You have deposited: " + ToNamFormat.ToNAMoneyFormat(true, amount) + "$"); Console.WriteLine("Curent balance: " + ToNamFormat.ToNAMoneyFormat(true, CurrentBalance) + "$"); }