static void Main(string[] args) { MattMurdock client1 = new MattMurdock(); Checking checking1 = new Checking(); Saving savings1 = new Saving(); string userChoice; string secondChoice; string thirdChoice; string fourthChoice; //Greeting from the cleints bank do { Console.WriteLine("Welcome to the bank of Hell's Kitchen!"); Console.WriteLine("How may I assist you today?"); Console.WriteLine("1.View Client Information \n2.View Account Balance \n3.Deposit Funds \n4.Withdraw Funds \n5.Exit"); userChoice = Console.ReadLine(); Console.Clear(); if (userChoice == "1") { client1.ClientInfo(); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (userChoice == "2") { do { Console.WriteLine("1. Checking \n2. Saving \n3. Back \n4. Exit"); secondChoice = Console.ReadLine(); Console.Clear(); if (secondChoice == "1") { checking1.CheckBalance(); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (secondChoice == "2") { savings1.CheckBalance(); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (secondChoice == "3") { break; } if (secondChoice == "4") { userChoice = "5"; break; } } while (secondChoice != "1" || secondChoice != "2" || secondChoice != "3" || secondChoice != "4"); } if (userChoice == "3") { do { Console.WriteLine("For which account would you like to make a deposit too?"); Console.WriteLine("1. Checking \n2. Saving \n3. Back \n4. Exit"); thirdChoice = Console.ReadLine(); Console.Clear(); if (thirdChoice == "1") { Console.WriteLine("How much would you like to deposit into your Checking Account?"); double deposit = Convert.ToDouble(Console.ReadLine()); checking1.Deposit(deposit); Console.WriteLine("Current Balance: $" + checking1.AccountBalance); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (thirdChoice == "2") { Console.WriteLine("How much would you like to deposit into your Savings Account?"); double deposit = Convert.ToDouble(Console.ReadLine()); savings1.Deposit(deposit); Console.WriteLine("Current Balance: $" + savings1.AccountBalance); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (thirdChoice == "3") { break; } if (thirdChoice == "4") { userChoice = "5"; break; } } while (thirdChoice != "1" || thirdChoice != "2" || thirdChoice != "3" || thirdChoice != "4"); } if (userChoice == "4") { do { Console.WriteLine("For which account would you like to make withdraw from?"); Console.WriteLine("1. Checking \n2. Saving\n3. Back \n4. Exit"); fourthChoice = Console.ReadLine(); Console.Clear(); if (fourthChoice == "1") { Console.WriteLine("How much would you like to withdraw from your Checking Account?"); double withdraw = Convert.ToDouble(Console.ReadLine()); checking1.Withdraw(withdraw); Console.WriteLine("Current Balance: $" + checking1.AccountBalance); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (fourthChoice == "2") { Console.WriteLine("How much would you like to withdraw from your Savings Account?"); double withdraw = Convert.ToDouble(Console.ReadLine()); if (withdraw > savings1.AccountBalance) { Console.WriteLine("I'm sorry, but you do not have sufficient funds for that transaction!"); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); break; } savings1.Withdraw(withdraw); Console.WriteLine("Current Balance: $" + savings1.AccountBalance); Console.WriteLine("Press enter when finished"); Console.ReadLine(); Console.Clear(); } if (fourthChoice == "3") { break; } if (fourthChoice == "4") { userChoice = "5"; break; } } while (fourthChoice != "1" || fourthChoice != "2" || fourthChoice != "3" || fourthChoice != "4"); } } while (userChoice != "5"); Console.WriteLine("We appreciate your business here at The Bank of Hell's Kitchen"); Console.WriteLine("Have a great day and watch out for that DareDevil guy!"); }
static void Main(string[] args) { Client client1 = new Client(); Checking checkingAccount = new Checking(); Savings savingsAccount = new Savings(); Console.WriteLine("Welcome to The Bank. You got money in it."); Console.WriteLine(); string mainMenu = "Main Menu \n\n1. View Client Information \n2. View Account Balance \n3. Withdraw Funds \n4. Deposit Funds \n5. Exit\n"; Console.WriteLine(mainMenu); while (true) { int menuChoice = int.Parse(Console.ReadLine()); if (menuChoice == 5) { Console.WriteLine(); Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else if (menuChoice == 1) { client1.ClientInformation(); Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (menuChoice == 2) { Console.WriteLine(); Console.WriteLine("1. Checking Account Balance \n2. Savings Account Balance"); Console.WriteLine(); int checkAccountBalance = int.Parse(Console.ReadLine()); if (checkAccountBalance == 1) { Console.WriteLine(); checkingAccount.DisplayAccountType(); checkingAccount.DisplayAccountNumber(); checkingAccount.DisplayAccountBalance(); Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (checkAccountBalance == 2) { Console.WriteLine(); savingsAccount.DisplayAccountType(); savingsAccount.DisplayAccountNumber(); savingsAccount.DisplayAccountBalance(); Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (menuChoice == 3) { Console.WriteLine(); Console.WriteLine("1. Withdraw from Checking Account \n2. Withdraw from Savings Account"); Console.WriteLine(); int withdrawFromAccount = int.Parse(Console.ReadLine()); Console.WriteLine(); if (withdrawFromAccount == 1) { Console.WriteLine("How much would you like to withdraw from your checking account today?"); Console.WriteLine(); double withdrawAmount = double.Parse(Console.ReadLine()); checkingAccount.Withdraw(withdrawAmount); while (checkingAccount.AccountBalance < 0) { checkingAccount.Overdraw(withdrawAmount); } if (checkingAccount.AccountBalance > 0) { Console.WriteLine(); Console.WriteLine("Your new current balance is ${0}", checkingAccount.AccountBalance); } Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (withdrawFromAccount == 2) { Console.WriteLine("How much would you like to withdraw from your savings account today?"); Console.WriteLine(); double withdrawAmount = double.Parse(Console.ReadLine()); Console.WriteLine(); savingsAccount.Withdraw(withdrawAmount); while (savingsAccount.AccountBalance < savingsAccount.MinimumBalance) { savingsAccount.Minimum(withdrawAmount); } if (savingsAccount.AccountBalance > savingsAccount.MinimumBalance) { Console.WriteLine("Your new current balance is ${0}", savingsAccount.AccountBalance); } Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (menuChoice == 4) { Console.WriteLine(); Console.WriteLine("1. Deposit into Checking Account \n2. Deposit into Savings Account"); Console.WriteLine(); int depositIntoAccount = int.Parse(Console.ReadLine()); if (depositIntoAccount == 1) { Console.WriteLine(); Console.WriteLine("How much would you like to deposit into your checking account today?"); Console.WriteLine(); double depositAmount = double.Parse(Console.ReadLine()); checkingAccount.Deposit(depositAmount); Console.WriteLine(); Console.WriteLine("Your new current balance is ${0}", checkingAccount.AccountBalance); Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else if (depositIntoAccount == 2) { Console.WriteLine(); Console.WriteLine("How much would you like to deposit into your savings account today?"); Console.WriteLine(); double depositAmount = double.Parse(Console.ReadLine()); savingsAccount.Deposit(depositAmount); Console.WriteLine(); Console.WriteLine("Your new current balance is ${0}", savingsAccount.AccountBalance); Console.WriteLine(); Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'."); Console.WriteLine(); int infoMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (infoMenu == 1) { Console.WriteLine(mainMenu); } else if (infoMenu == 5) { Console.WriteLine("Thank you for choosing The Bank."); Console.WriteLine(); break; } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else { Console.WriteLine(); Console.WriteLine("Please enter a valid number."); Console.WriteLine(); Console.WriteLine(mainMenu); Console.WriteLine(); } } else { Console.WriteLine("Please choose from the options listed below."); MainMenu(); } } }
static void Main(string[] args) { Client mainClient = new Client(); Checking checking1 = new Checking(); Saving saving1 = new Saving(); double amount; int menuChoice = 0; int moreChoice = 0; while (menuChoice < 1 || menuChoice > 5) { while (menuChoice != 5) { Console.WriteLine("Welcome to SHAM WOW Bank."); Console.WriteLine("How can we you help today?"); 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"); menuChoice = int.Parse(Console.ReadLine()); if (menuChoice == 1) { mainClient.ViewInfo(); // <-- printing out clients information break; } else if (menuChoice == 2) { while (moreChoice < 1 || moreChoice > 2) { Console.WriteLine("Which account would you like to access?"); Console.WriteLine("1.Checking Account"); Console.WriteLine("2.Saving Account"); moreChoice = int.Parse(Console.ReadLine()); } if (moreChoice == 1) { checking1.ViewInfo(); break; } else if (moreChoice == 2) { saving1.ViewInfo(); break; } } else if (menuChoice == 3) { Console.WriteLine("How much would you like to deposit?"); amount = double.Parse(Console.ReadLine()); while (moreChoice < 1 || moreChoice > 2) { Console.WriteLine("Where would you like to deposit?"); Console.WriteLine("1.Checking Account"); Console.WriteLine("2.Saving Account"); moreChoice = int.Parse(Console.ReadLine()); if (moreChoice == 1) { checking1.Deposit(amount); checking1.ViewInfo(); break; } else if (moreChoice == 2) { saving1.Deposit(amount); saving1.ViewInfo(); break; } } } else if (menuChoice == 4) { Console.WriteLine("How much would you like to withdraw?"); amount = double.Parse(Console.ReadLine()); while (moreChoice < 1 || moreChoice > 2) { Console.WriteLine("Where would you like to withdraw?"); Console.WriteLine("1.Checking Account"); Console.WriteLine("2.Saving Account"); moreChoice = int.Parse(Console.ReadLine()); if (moreChoice == 1) { checking1.Withdraw(amount); checking1.ViewInfo(); break; } else if (moreChoice == 2) { // saving1.InsufficientFunds(); <-- could not understand how to incorperate a min value without funds to go under saving1.Withdraw(amount); saving1.ViewInfo(); break; } } } else if (menuChoice == 5) { Console.WriteLine("Thank you for banking with SHAM WOW."); Environment.Exit(0); return; } else { Console.WriteLine("Invalid. \nPlease pick another option"); } } } }