//Constructors public Client(string clientName, double savingsOpen, double checkingOpen, double reserveOpen) //Using type of account as key for expedience { ClientName = clientName; ClientAccountNumbers = clientAccountNumbers; ClientAccountNumbers.Add("Checking", 1234); ClientAccountNumbers.Add("Savings ", 7890); ClientAccountNumbers.Add("Reserve ", 2468); Checking currentChecking = new Checking(ClientAccountNumbers["Checking"], ClientName, checkingOpen); ClientAccounts.Add(1234, currentChecking); Savings currentSavings = new Savings(ClientAccountNumbers["Savings "], ClientName, savingsOpen); ClientAccounts.Add(7890, currentSavings); Reserve currentReserve = new Reserve(ClientAccountNumbers["Reserve "], ClientName, reserveOpen); ClientAccounts.Add(2468, currentReserve); }
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 customer = new Client("Jackie", "Piedra", "*****@*****.**", 54132215); Checking customerChecking = new Checking(7806001, 5000m); Savings customerSavings = new Savings(7806002, 12000m); Console.WriteLine("Welcome to Bank Manager, {0}!", customer.FirstName); Console.ReadLine(); int bankAccount; bool exit = true; do { MainMenu(); int userSelection = int.Parse(Console.ReadLine()); switch (userSelection) { case 1: customer.CustomerInformation(); break; case 2: BankAccountSelection(); bankAccount = int.Parse(Console.ReadLine()); if (bankAccount == 1) { customerChecking.CurrentBalance(); ResetToMenu(); break; } else if (bankAccount == 2) { customerSavings.CurrentBalance(); ResetToMenu(); break; } else { Console.WriteLine("\nThat is not a valid entry"); ResetToMenu(); break; } case 3: BankAccountSelection(); bankAccount = int.Parse(Console.ReadLine()); decimal depositAmount; if (bankAccount == 1) { Console.WriteLine("\nEnter your deposit amount:"); depositAmount = decimal.Parse(Console.ReadLine()); customerChecking.DepositFunds(depositAmount); customerChecking.CurrentBalance(); ResetToMenu(); break; } else if (bankAccount == 2) { Console.WriteLine("\nEnter your deposit amount:"); depositAmount = decimal.Parse(Console.ReadLine()); customerSavings.DepositFunds(depositAmount); customerSavings.CurrentBalance(); ResetToMenu(); break; } else { Console.WriteLine("\nThat is not a valid entry"); ResetToMenu(); break; } case 4: BankAccountSelection(); bankAccount = int.Parse(Console.ReadLine()); decimal withdrawalAmount; if (bankAccount == 1) { Console.WriteLine("\nEnter your withdrawal amount:"); withdrawalAmount = decimal.Parse(Console.ReadLine()); customerChecking.WithdrawFunds(withdrawalAmount); customerChecking.CurrentBalance(); ResetToMenu(); break; } else if (bankAccount == 2) { if (customerSavings.AccountBalance < customerSavings.MinimumBalance) { Console.WriteLine("You must have a minimum balance of {0:c} in order to withdraw funds", customerSavings.MinimumBalance); Console.WriteLine("Current Account Balance is {0:c}", customerSavings.AccountBalance); ResetToMenu(); break; } else { Console.WriteLine("\nEnter your withdrawal amount:"); withdrawalAmount = decimal.Parse(Console.ReadLine()); customerSavings.WithdrawFunds(withdrawalAmount); customerSavings.CurrentBalance(); ResetToMenu(); break; } } else { Console.WriteLine("That is not a valid entry"); ResetToMenu(); break; } case 5: Console.WriteLine("Thank you for using Bank Manager!"); exit = false; break; default: break; } } while (exit); }
static void Main(string[] args) { //Objex Checking myChecking = new Checking(); Savings mySavings = new Savings(); Reserve myReserve = new Reserve(); Accounts myAccount = new Accounts(); Console.WriteLine("Welcome to The First National Bank of Keith!"); Console.WriteLine(); //bool used in do-while loop bool cycleAccount = true; //do-while loop cycles through program do { Console.WriteLine("Which account would you like to access today?\nChecking, Savings, or Reserve?"); string accountType = Console.ReadLine(); accountType = accountType.ToLower(); if (accountType == "checking") //Checking account functions { myChecking.DisplayAccountStats(); Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds"); Console.WriteLine(); string checkingAction = Console.ReadLine(); checkingAction = checkingAction.ToLower(); if (checkingAction == "withdraw") { myChecking.withdrawMethod(0); myChecking.DisplayAccountStats(); } else if (checkingAction == "deposit") { myChecking.depositMethod(0); myChecking.DisplayAccountStats(); } else { Console.WriteLine("Error: Invalid response."); Console.WriteLine(); } } else if (accountType == "savings") //Savings Account functions { mySavings.DisplayAccountStats(); Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds"); Console.WriteLine(); string savingsAction = Console.ReadLine(); savingsAction = savingsAction.ToLower(); if (savingsAction == "withdraw") { mySavings.withdrawMethod(0); mySavings.DisplayAccountStats(); } else if (savingsAction == "deposit") { mySavings.depositMethod(0); mySavings.DisplayAccountStats(); } else { Console.WriteLine("Error: Invalid response."); Console.WriteLine(); } } else if (accountType == "reserve") //Reserve Account functions { myReserve.DisplayAccountStats(); Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds"); Console.WriteLine(); string reserveAction = Console.ReadLine(); reserveAction = reserveAction.ToLower(); if (reserveAction == "withdraw") { myReserve.withdrawMethod(0); myReserve.DisplayAccountStats(); } else if (reserveAction == "deposit") { myReserve.depositMethod(0); myReserve.DisplayAccountStats(); } else { Console.WriteLine("Error: Invalid response."); Console.WriteLine(); } } else { Console.WriteLine("Error: Invalid response."); Console.WriteLine(); } } while (cycleAccount == true); Console.ReadKey(); }
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 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"); } } } }
static void Main(string[] args) { Checking checking = new Checking(); Savings savings = new Savings(); Reserve reserve = new Reserve(); Accounts account1 = new Accounts(); string clientInput; StringBuilder mainMenu = new StringBuilder(); mainMenu.Append("OurBank Main Menu\n"); mainMenu.Append("View Client Information, Press '1'\n"); mainMenu.Append("View Account Balance Information, Press '2'\n"); mainMenu.Append("To Deposit Funds from checking, Press '3'\n"); mainMenu.Append("To Withdraw Funds from checking, Press '4'\n"); mainMenu.Append("To Exit the Application, Press '5'\n"); mainMenu.Append("Thank you for being a valued OurBank customer!\n"); mainMenu.Append("Today's Date and time is: " + DateTime.Now + "\n"); Console.WriteLine(mainMenu.ToString()); clientInput = Console.ReadLine().ToUpper(); if (clientInput == "1") { account1.PrintStats(); } else if (clientInput == "2") { checking.PrintCheckingStats(); reserve.PrintReserveStats(); savings.PrintStats1(); } else if (clientInput == "3") { checking.Deposit(); } else if (clientInput == "4") { Console.WriteLine("Do you want to write a check (1), or withdraw from savings (2)?"); int userResponse = Convert.ToInt32(Console.ReadLine()); if (userResponse == 1) { checking.WriteCheck(); } else { savings.Withdraw(); } } Console.ReadKey(); StreamWriter checkingWriter = new StreamWriter("checking.txt"); using (checkingWriter) { checkingWriter.Write(DateTime.Now); } StreamWriter savingsWriter = new StreamWriter("savings.txt"); using (savingsWriter) { savingsWriter.Write(DateTime.Now); } StreamWriter reserveWriter = new StreamWriter("reserve.txt"); using (reserveWriter) { reserveWriter.Write(DateTime.Now); } }
static void Main(string[] args) { string userChoice; string accountChoice; do { Client newClient = new Client(); Checking newChecking = new Checking(); Savings newSavings = new Savings(); //Cold open Console.WriteLine("Please select the number from the following 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"); userChoice = Console.ReadLine().Trim(); if (userChoice == "1") { newClient.GetCustomerInfo(); } else if (userChoice == "2") { Console.WriteLine("A Checking"); Console.WriteLine("B Savings"); accountChoice = Console.ReadLine().ToLower(); if (accountChoice == "a") { //Check Balance Checking Account newChecking.IntialBalanceCheck(); } else { //check Balance Savings Account newSavings.InitialSavingsCheck(); } } else if (userChoice == "3") { Console.WriteLine("A Checking"); Console.WriteLine("B Savings"); accountChoice = Console.ReadLine().ToLower(); if (accountChoice == "a") { //deposit checking funds newChecking.DepositUpdate(); } else { //deposit saving funds newSavings.DepositUpdate(); } } else if (userChoice == "4") { Console.WriteLine("A Checking"); Console.WriteLine("B Savings"); accountChoice = Console.ReadLine().ToLower(); if (accountChoice == "a") { //deposit checking funds newChecking.CheckingWithdrawUpdate(); } else { //deposit saving funds newSavings.CheckinWithdrawUpdate(); } } }while (userChoice == "1" || userChoice == "2" || userChoice == "3" || userChoice == "4"); if (userChoice == "5") { Console.WriteLine("Thank you for banking today"); } }