static void Main(string[] args) { Client Monica = new Client("Monica", "Johnson", "Cleveland"); Client Marty = new Client("Marty", "Kent", "Boston Heights"); Console.WriteLine("Please select from the following menu options:"); Console.WriteLine("1. View client information."); Console.WriteLine("2. View account balance."); Console.WriteLine("3. Deposit funds."); Console.WriteLine("4. Withdraw funds."); Console.WriteLine("5. Exit"); Checking MartyK = new Checking(1234, 34.50, 10.00, 0, 0, 0); Savings MonicaJ = new Savings(4567, 20.50, 13.00, 0, 0, 0); Console.WriteLine("Your account number is {0}. ", MartyK.AccountNumber); Console.WriteLine("Your account number is {0}.", MonicaJ.AccountNumber); int userResponse = int.Parse(Console.ReadLine()); do { switch (userResponse) { case 1: Console.WriteLine("a. Checking account"); Console.WriteLine("b. Savings account "); string answerInfo = Console.ReadLine().ToLower(); if (answerInfo == "a") { Console.WriteLine(Monica.GetInfo()); } if (answerInfo == "b") { Console.WriteLine(Marty.GetInfo()); } break; case 2: Console.WriteLine("a. Checking account"); Console.WriteLine("b. Savings account"); string answerBal = Console.ReadLine().ToLower(); if (answerBal == "a") { Console.WriteLine(MartyK.GetBalance()); } if (answerBal == "b") { Console.WriteLine(MonicaJ.GetBalance()); } break; case 3: Console.WriteLine(MartyK.Deposit()); break; case 4: Console.WriteLine("a. Checking account"); Console.WriteLine("b. Savings account"); string answerWithdrawal = Console.ReadLine().ToLower(); if (answerWithdrawal == "a") { Console.WriteLine(MartyK.Withdrawal()); } if (answerWithdrawal == "b") { Console.WriteLine(MonicaJ.Withdrawal()); } break; case 5: break; } }while (userResponse != 5); }
static void Main(string[] args) { int userResp; double depositAmt; double withdrawalAmt; double newDepBal; double newWithdrawalBal; int depositResp; string exitResp; Checking checking = new Checking(65237, 5000, 15); Savings savings = new Savings(65238, 2500, 10); Client pete = new Client("pete", "1234 WCCI Street", "440 123 4567"); Console.WriteLine("Welcome to the Bank of We Can Code It. Would you like to manage your accounts?"); Console.WriteLine("YES / EXIT"); exitResp = Console.ReadLine().ToLower(); while (exitResp.Equals("yes")) { Console.WriteLine("Press 1 to manage checking account"); Console.WriteLine("Press 2 to manage savings account"); userResp = int.Parse(Console.ReadLine()); savings.AddInterest(); checking.AddInterest(); if (userResp == 1) { checking.AddInterest(); } { Console.WriteLine("Current checking account balance is: $" + (checking.GetBalance() /*+ checking.Interest)*/)); } if (userResp == 2) { Console.WriteLine("Current savings account balance is: $" + (savings.GetBalance() + savings.Interest)); } Console.WriteLine("Press 1 to deposit to checking"); Console.WriteLine("Press 2 to deposit to savings"); depositResp = int.Parse(Console.ReadLine()); savings.AddInterest(); checking.AddInterest(); if (userResp == 1) { Console.WriteLine("How much money would you like to deposit?"); Console.Write("$"); depositAmt = double.Parse(Console.ReadLine()); newDepBal = checking.GetDeposit(depositAmt); savings.AddInterest(); checking.AddInterest(); Console.WriteLine("Your new checking account balance is: $" + (checking.GetDeposit(depositAmt))); Console.WriteLine("How much money would you like to withdrawal?"); Console.Write("$"); withdrawalAmt = double.Parse(Console.ReadLine()); savings.AddInterest(); checking.AddInterest(); Console.WriteLine("Your new checking account balance is: $" + checking.GetWithdrawal(withdrawalAmt - newDepBal)); } if (userResp == 2) { Console.WriteLine("How much money would you like to deposit?"); Console.Write("$"); depositAmt = double.Parse(Console.ReadLine()); newWithdrawalBal = savings.GetDeposit(depositAmt); savings.AddInterest(); checking.AddInterest(); Console.WriteLine("Your new savings account balance is: $" + savings.GetDeposit(depositAmt)); Console.WriteLine("How much money would you like to withdrawal?"); Console.Write("$"); withdrawalAmt = double.Parse(Console.ReadLine()); savings.AddInterest(); checking.AddInterest(); Console.WriteLine("Your new savings account balance is: $" + savings.GetWithdrawal(withdrawalAmt - newWithdrawalBal)); } Console.WriteLine("Would you like to manage your accounts again?"); exitResp = Console.ReadLine().ToLower(); savings.AddInterest(); checking.AddInterest(); } while (exitResp.Equals("exit")) { Console.WriteLine("Have a good day."); break; } }