// private static DateTime Withdrawaltime; static void Main(string[] args) { //string depositFunds1 = (Console.ReadLine()); Console.WriteLine("Sam Smith account"); Console.WriteLine("Account number:12345 67890 98765"); Account management = new Account(); //management.withdrawal_ = 00.00M; //management.Deposit_ = 00.00M; //management.Interest_ = 00.00M; Checking management0 = new Checking(); //management0.withdrawal_ = 00.00M; //management0.Deposit_ = 00.00M; //management0.Interest_ = 00.00M; Savings management1 = new Savings(); //management1.withdrawal_ = 00.00M; //management1.Deposit_ = 00.00M; //management1.Interest_ = 00.00M; Reserved management2 = new Reserved(); //management2.withdrawal_ = 00.00M; //management2.Deposit_ = 00.00M; //management2.Interest_ = 00.00M; management.AcountInformation(); DateTime value = new DateTime(2017, 3, 13); Console.WriteLine(value); }
static void Main(string[] args) { Client clientIce = new Client("Ice", "Man", "01110"); Checking checkingIce = new Checking(); Saving savingIce = new Saving(); Console.WriteLine(" 1.View Client Information\n 2.View Client Balance\n 3.Deposit Funds\n 4.Withdraw Funds\n 5.Exit"); string option = Console.ReadLine(); switch (option) { } }
//method public void ShowClientInfo() { //instantiating instances of checking and savings to show client's account number info. Checking checkingInst = new Checking(); Savings savingsInst = new Savings(); Console.WriteLine("CLIENT INFORMATION: "); Console.WriteLine("Name:\t\t\t" + ClientNameProp); Console.WriteLine("Address:\t\t" + ClientAddressProp); Console.WriteLine("Email:\t\t\t" + ClientEmailProp); //using instance variables to get account type and number via properties inherited from the base account class. Console.WriteLine(checkingInst.AccountTypeProp + " Account:\t" + checkingInst.AccountNumberProp); Console.WriteLine(savingsInst.AccountTypeProp + " Account:\t" + savingsInst.AccountNumberProp + "\n"); }
static void Main(string[] args) { //variable double depositMoney = 0; //user input Console.Write("Name: "); string name = Console.ReadLine(); Console.Write("Account number: "); string accountNum = Console.ReadLine(); Console.Write("Checking or Savings: "); string checkSave = Console.ReadLine(); //instanciate Checking personCheck = new Checking(accountNum, 0, "checking"); Savings personSavings = new Savings(accountNum, 0, "savings", 0); if (checkSave.ToLower() == "checking") { Console.Write("how much do you want to deposit into your checking account: "); depositMoney = double.Parse(Console.ReadLine()); } else if (checkSave.ToLower() == "savings") { Console.Write("how much do you want to deposit into your savings account: "); depositMoney = double.Parse(Console.ReadLine()); } //Get Client Client person = new Client("joe", "440", "123"); for (int i = 1; i < 4; i++) { Console.WriteLine(person.GetClient(i)); } }
static void Main(string[] args) { Menu display = new Menu(); display.Greeting(); Client clientInfo = new Client(); clientInfo.AccountName = Console.ReadLine(); clientInfo.AccountAddress = "141 Piletas Arce \nLares, Puerto Rico \n00669"; clientInfo.AccountPhone = "(787)762-1410"; Checking checkingAccount = new Checking(); checkingAccount.AccountNumber = 900785211; checkingAccount.AccountType = "Checking"; checkingAccount.CurrentBalance = 987.33; Savings savingsAccount = new Savings(); savingsAccount.AccountNumber = 900785212; savingsAccount.AccountType = "Savings"; savingsAccount.CurrentBalance = 101.69; int userChoice = 0; double amount; Console.WriteLine( ); display.DisplayHeader(); Console.WriteLine(); do { display.MenuOptions(); Console.Write(" Please select a number of your choice "); userChoice = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); switch (userChoice) { case 1: Console.Write("How much money would you like to deposit to your Checking Account: $"); amount = Convert.ToDouble(Console.ReadLine()); checkingAccount.Deposit(amount); Console.WriteLine(" Your current checking account balance is now ${0}", " " + checkingAccount.CurrentBalance); Console.WriteLine(); break; case 2: Console.Write("How much money would you like to deposit to your Savings Account: $"); amount = Convert.ToDouble(Console.ReadLine()); savingsAccount.Deposit(amount); Console.WriteLine(" Your current savings account balance is now ${0}", " " + savingsAccount.CurrentBalance); Console.WriteLine(); break; case 3: Console.Write("How much would you like to withdraw from your Checking Account: $"); amount = Convert.ToDouble(Console.ReadLine()); checkingAccount.Withdrawal(amount); Console.WriteLine(" Your current checking account balance is now ${0}", " " + checkingAccount.CurrentBalance); Console.WriteLine(); break; case 4: Console.Write("How much money would you like to withdraw from your Savings Account: $"); amount = Convert.ToDouble(Console.ReadLine()); savingsAccount.Withdrawal(amount); Console.WriteLine(" Your current savings account balance is now ${0}", " " + savingsAccount.CurrentBalance); Console.WriteLine(); break; case 5: clientInfo.DisplayAccount(clientInfo.AccountName); Console.WriteLine(); break; case 6: Console.WriteLine("{0} {1}\t\t\t{2}\t\t\n", checkingAccount.AccountType, checkingAccount.AccountNumber, checkingAccount.CurrentBalance); Console.WriteLine("{0} {1}\t\t\t{2}\t\t\n", savingsAccount.AccountType, savingsAccount.AccountNumber, savingsAccount.CurrentBalance); Console.WriteLine(); break; } } while (userChoice != 7); Console.WriteLine("Thank you for being a valued customer at TreeBank. Have a good day"); }
static void Main(string[] args) { //Declaring the global variables I'll be using for the program class int topMenu; char subMenu; //instantiating 3 classes Client user = new Client("JJax12345", "Joe Jackson", 2, "1491721"); Checking checkingAccount = new Checking("741776", 5000.00d); Savings savingsAccount = new Savings("1002119", 2500.00d); //Welcomes user and prompts them to select an option Console.WriteLine("Welcome to the Bank of Knox remote account program."); Console.WriteLine("\nCurrently logged in under {0}.", user.UserName); Console.WriteLine("\nPlease select an option below via the corresponding number:"); Console.WriteLine(); //main menu do { 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"); Console.Write("\nWhat would you like to do? "); topMenu = int.Parse(Console.ReadLine()); Console.WriteLine(); if (topMenu == 1) { user.ClientInfo(); Console.WriteLine("Checking account number: {0}", checkingAccount.AccountNumber); Console.WriteLine("Savings account number: {0}", savingsAccount.AccountNumber); Console.WriteLine(); } else if (topMenu == 2) { //sub-menu loop do { Console.WriteLine("\nPlease choose the account you would like to check: "); Console.WriteLine("a. Checking Account"); Console.WriteLine("b. Savings Account"); Console.WriteLine("c. Main Menu"); Console.WriteLine(); subMenu = char.Parse(Console.ReadLine().Trim().ToLower()); if (subMenu == 'a') { checkingAccount.CheckBalance(); } else if (subMenu == 'b') { savingsAccount.CheckBalance(); } else if (subMenu != 'a' && subMenu != 'b' && subMenu != 'c') { Console.WriteLine("Please enter a valid choice"); } } while (subMenu != 'c'); } else if (topMenu == 3) { //sub-menu loop do { Console.WriteLine("\nPlease choose the account you would like to deposit funds to: "); Console.WriteLine("a. Checking Account"); Console.WriteLine("b. Savings Account"); Console.WriteLine("c. Main Menu"); Console.WriteLine(); subMenu = char.Parse(Console.ReadLine().Trim().ToLower()); if (subMenu == 'a') { Console.WriteLine("\nHow much would you like to deposit?"); checkingAccount.Deposit(double.Parse(Console.ReadLine())); } else if (subMenu == 'b') { Console.WriteLine("\nHow much would you like to deposit?"); savingsAccount.Deposit(double.Parse(Console.ReadLine())); } else if (subMenu != 'a' && subMenu != 'b' && subMenu != 'c') { Console.WriteLine("Please enter a valid choice"); } } while (subMenu != 'c'); } else if (topMenu == 4) { //sub-menu loop do { Console.WriteLine("\nPlease choose the account you would like to withdraw funds from: "); Console.WriteLine("a. Checking Account"); Console.WriteLine("b. Savings Account"); Console.WriteLine("c. Main Menu"); Console.WriteLine(); subMenu = char.Parse(Console.ReadLine().Trim().ToLower()); if (subMenu == 'a') { Console.WriteLine("\nHow much would you like to withdraw?"); checkingAccount.Withdrawal(double.Parse(Console.ReadLine())); } else if (subMenu == 'b') { Console.WriteLine("\nHow much would you like to withdraw?"); savingsAccount.Withdrawal(double.Parse(Console.ReadLine())); } else if (subMenu != 'a' && subMenu != 'b' && subMenu != 'c') { Console.WriteLine("Please enter a valid choice"); } } while (subMenu != 'c'); } else if (topMenu > 5) { Console.WriteLine("Please enter a valid choice."); Console.WriteLine(); } } while (topMenu != 5); Console.WriteLine("\nThank you for banking with us."); Console.WriteLine("\nHave a nice day!"); Console.WriteLine(); }
public static void Main(string[] args) { Account account = new Account(); Savings savings = new Savings(10000); Checking checking = new Checking(2000); string clientInfo = account.DisplayAccountHolderFullName(); string checkingAccountType = checking.AccountType; string savingsAccountType = savings.AccountType; IList <string> checkingAccountSummary = new List <string>(); IList <string> savingsAccountSummary = new List <string>(); checkingAccountSummary.Add(clientInfo); checkingAccountSummary.Add(checkingAccountType); savingsAccountSummary.Add(clientInfo); savingsAccountSummary.Add(savingsAccountType); string userChoice = ""; do { string checkingDepositAmount = ($"Transaction: +${checking.DepositAmount} at {DateTime.Now}" + $"Current Balance: ${checking.Balance}"); string savingsDepositAmount = ($"Transaction: +${savings.DepositAmount} at {DateTime.Now}" + $"Current Balance: ${savings.Balance}"); string checkingWithrdawAmount = ($"Transaction: -${checking.WithdrawAmount} at {DateTime.Now}" + $"Current Balance: ${checking.Balance}"); string savingsWithrdawAmount = ($"Transaction: -${savings.WithdrawAmount} at {DateTime.Now}" + $"Current Balance: ${savings.Balance}"); if (checking.DepositAmount > 0) { checkingAccountSummary.Add(checkingDepositAmount); checking.DepositAmount = 0; } if (savings.DepositAmount > 0) { savingsAccountSummary.Add(savingsDepositAmount); savings.DepositAmount = 0; } if (checking.WithdrawAmount > 0) { checkingAccountSummary.Add(checkingWithrdawAmount); checking.WithdrawAmount = 0; } if (savings.WithdrawAmount > 0) { savingsAccountSummary.Add(savingsWithrdawAmount); savings.WithdrawAmount = 0; } account.DisplayFirstMessage(); Console.ReadLine(); account.DisplayMenu(); userChoice = Console.ReadLine(); switch (userChoice.ToUpper()) { case "I": Console.Clear(); Console.WriteLine(clientInfo); break; case "CB": Console.Clear(); checking.AccountBalance(); Console.WriteLine("Checking Account Balance: ${0}", checking.Balance); break; case "SB": Console.Clear(); savings.AccountBalance(); Console.WriteLine("Savings Account Balance: ${0}", savings.Balance); break; case "CD": Console.Clear(); Console.WriteLine("How much would you like to deposit?"); checking.DepositAmount = double.Parse(Console.ReadLine()); Console.WriteLine("You deposited: ${0}", checking.DepositAmount); checking.DepositBalance(checking.DepositAmount); break; case "SD": Console.Clear(); Console.WriteLine("How much would you like to deposit?"); savings.DepositAmount = double.Parse(Console.ReadLine()); Console.WriteLine("You deposited: ${0}", savings.DepositAmount); savings.DepositBalance(savings.DepositAmount); break; case "CW": Console.Clear(); Console.WriteLine("How much would you like to withdraw?"); checking.WithdrawAmount = double.Parse(Console.ReadLine()); Console.WriteLine("You withdrew: ${0}", checking.WithdrawAmount); checking.WithdrawBalance(checking.WithdrawAmount); break; case "SW": Console.Clear(); Console.WriteLine("How much would you like to withdraw?"); checking.WithdrawAmount = double.Parse(Console.ReadLine()); Console.WriteLine("You withdrew: ${0}", checking.WithdrawAmount); checking.WithdrawBalance(checking.WithdrawAmount); break; case "X": Console.Clear(); account.WriteSummary(checkingAccountSummary, "Checking"); account.WriteSummary(savingsAccountSummary, "Savings"); Console.WriteLine("Thanks and come again!"); Environment.Exit(0); break; } } while (userChoice.ToUpper() != "X"); }
static void Main(string[] args) { // instantiate client, checking, saveings Client steveSteve = new Client("Grey", "Grey", "Steve Steve"); Saveings saveStare = new Saveings(0001, 50.00d); Checking makeItRain = new Checking(4987, 123456.99d); bool exit = false; string toMM = ""; // do while until exit do { // menu switch case calls methods Console.WriteLine("\tWeclome to FakeBank, please enter a selection.\n"); Console.WriteLine("\t\t[1]We know what you look like.\n\n\t\t[2]View account balences." + "\n\n\t\t[3]Deposit Funds \n\n\t\t[4]Withdraw Funds \n\n\t\t[5]Exit"); string input = Console.ReadLine(); switch (input) { case "1": do { Console.WriteLine("Welcom: "); steveSteve.GetClientInfo(); Console.WriteLine("\n[R] to main menu."); toMM = Console.ReadLine().ToLower(); }while (toMM != "r"); break; case "2": Console.WriteLine("\t Which balance would you like?" + "\n\t\t[A] Checking Account\n\t\t[B] Saveings Account"); string accountSelect = Console.ReadLine().ToLower(); if (accountSelect == "a") { makeItRain.GetChecking(); } if (accountSelect == "b") { saveStare.GetSaveings(); } break; case "3": Console.WriteLine("\t For which account would you like make a deposit?" + "\n\t\t[A] Checking Account\n\t\t[B] Saveings Account"); string depositSelect = Console.ReadLine().ToLower(); if (depositSelect == "a") { Console.WriteLine("How much would you like to deposit?"); double deposit = double.Parse(Console.ReadLine()); makeItRain.MakeDeposit(checkingBalance, deposit); makeItRain.GetChecking(); } if (depositSelect == "b") { Console.WriteLine("How much would you like to deposit?"); double deposit = double.Parse(Console.ReadLine()); saveStare.MakeDeposit(checkingBalance, deposit); saveStare.GetSaveings(); } break; case "4": Console.WriteLine("\t For which account would you like to make a withdraw?" + "\n\t\t[A] Checking Account\n\t\t[B] Saveings Account"); string withdrawSelect = Console.ReadLine(); if (withdrawSelect == "a") { Console.WriteLine("How much would you like to withdraw?"); double withdraw = double.Parse(Console.ReadLine()); makeItRain.MakeWithdraw(checkingBalance, withdraw); makeItRain.GetChecking(); } if (withdrawSelect == "b") { Console.WriteLine("How much would you like to withdraw?"); double withdraw = double.Parse(Console.ReadLine()); saveStare.MakeWithdraw(checkingBalance, withdraw); saveStare.GetSaveings(); } break; case "5": Console.WriteLine("Thank you for banking with FakeBank."); exit = true; break; } }while (exit == false); }
static void Main(string[] args) { //testing client object //instantiate one client object Client clientInst = new Client(); //clientInst.ShowClientInfo(); //testing checking object //instantiate one checking object Checking checkingInst = new Checking(); //testing savings object //instantiate one savings object Savings savingsInst = new Savings(); string strMenuChoice; int menuChoice; //display state Console.BackgroundColor = ConsoleColor.DarkBlue; Console.Clear(); do { //Menu layout Console.WriteLine("Please make a selection of 1, 2, 3, 4 or 5 below: "); Console.WriteLine(); 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"); Console.WriteLine("\n"); //Processed menu options strMenuChoice = Console.ReadLine(); menuChoice = int.Parse(strMenuChoice); switch (menuChoice) { case 1: clientInst.ShowClientInfo(); Console.WriteLine("\n"); break; case 2: Console.WriteLine("Enter C for Checking: "); Console.WriteLine("Enter S for Savings: \n"); string balanceOption = Console.ReadLine(); if (balanceOption.ToLower() == "c") { checkingInst.showCurrentBalance(); } else if (balanceOption.ToLower() == "s") { savingsInst.showCurrentBalance(); } Console.WriteLine("\n"); break; case 3: Console.WriteLine("Enter C for Checking: "); Console.WriteLine("Enter S for Savings: \n"); string depositOption = Console.ReadLine(); if (depositOption.ToLower() == "c") { Console.WriteLine("Deposit Amount: "); decimal depositAmount = Decimal.Parse(Console.ReadLine()); checkingInst.depositFunds(depositAmount); checkingInst.showCurrentBalance(); } else if (depositOption.ToLower() == "s") { Console.WriteLine("Deposit Amount: "); decimal depositAmount = Decimal.Parse(Console.ReadLine()); savingsInst.depositFunds(depositAmount); savingsInst.showCurrentBalance(); } Console.WriteLine("\n"); break; case 4: Console.WriteLine("Enter C for Checking: "); Console.WriteLine("Enter S for Savings: \n"); string withdrawalOption = Console.ReadLine(); if (withdrawalOption.ToLower() == "c") { Console.WriteLine("Withdrawal Amount: "); decimal withdrawalAmount = Decimal.Parse(Console.ReadLine()); checkingInst.withdrawFunds(withdrawalAmount); checkingInst.showCurrentBalance(); } else if (withdrawalOption.ToLower() == "s") { Console.WriteLine("\nWithdrawal Amount: "); decimal withdrawalAmount = Decimal.Parse(Console.ReadLine()); savingsInst.withdrawFunds(withdrawalAmount); savingsInst.showCurrentBalance(); } Console.WriteLine("\n"); break; case 5: Console.WriteLine("Exit"); Console.WriteLine("\n"); break; default: Console.WriteLine("I'm sorry, I don't understand that!"); Console.WriteLine("\n"); break; } }while (menuChoice != 5); System.Environment.Exit(0); }
static void Main(string[] args) { //Instantiated Client,Checking,Saving Client JerrySeinfeld = new Client(); Checking SeinfeldChecking1 = new Checking(); Savings SeinfeldSavings1 = new Savings(); //Accounts string choice1; string choice2; double deposit; double withdraw; //do { //Welcome User Console.WriteLine("Welocme to Kramerica Bank"); Console.WriteLine("Please make a selection"); Console.WriteLine("1. View Client Informtion\n 2. View Account Balance\n 3. Deposit Funds \n 4. Withdraw Funds\n 5. Exit"); Console.WriteLine("Please Enter a selection"); choice1 = Console.ReadLine(); Console.Clear(); // Display User info if (choice1 == "1") { JerrySeinfeld.CustomerInfo(); Console.Write("Please hit the enter key after selection"); Console.ReadLine(); Console.Clear(); } //Check Account Balances if (choice1 == "2") { do { Console.WriteLine("1.Checking Balance\n2. Savings Balance\n3. Back to Menu\n4.Exit "); choice2 = Console.ReadLine(); Console.Clear(); if (choice2 == "1") { Console.WriteLine("Your Checking balance is {0}", SeinfeldChecking1.AccountBalance); } if (choice2 == "2") { Console.WriteLine("Your Savings balance is {0}", SeinfeldSavings1.AccountBalance); } if (choice2 == "3") { break; } if (choice2 == "4") { if (choice1 == "5") { break; } } } while (choice2 != "1" || choice2 != "2" || choice2 != "3" || choice2 != "4"); } //Deposit Funds if (choice1 == "3") { do { Console.WriteLine("Which Account would like to deposit?\n 1.Checking\n 2. Savings \n 3.back\n 4. Exit "); choice1 = Console.ReadLine(); Console.Clear(); { Console.WriteLine("How much to deposit"); deposit = double.Parse(Console.ReadLine()); SeinfeldChecking1.AccountBalance = SeinfeldChecking1.Deposit(deposit); Console.WriteLine("Your balance is now {0}", SeinfeldChecking1.AccountBalance); Console.WriteLine("Enter to continue"); Console.ReadLine(); Console.Clear(); { Console.WriteLine("How much to deposit?"); deposit = double.Parse(Console.ReadLine()); SeinfeldChecking1.AccountBalance = SeinfeldSavings1.Deposit(deposit); Console.WriteLine("Your balance is now {0}", SeinfeldSavings1.AccountBalance); Console.WriteLine("Enter to continue"); Console.ReadLine(); Console.Clear(); } { break; } if (choice2 == "4") { break; } } while (choice2 != "1" || choice2 != "2" || choice2 != "3" || choice2 != "4") { ; } //Allow for Withdrawals if (choice1 == "4") { do { Console.WriteLine("Which account to withdraw?\n 1. Checking\n 2. Savings\n 3. Back\n 4.Exit "); choice2 = Console.ReadLine(); Console.Clear(); if (choice2 == "1") { Console.WriteLine("How much to withdraw?"); withdraw = double.Parse(Console.ReadLine()); SeinfeldChecking1.Withdraw(withdraw); Console.WriteLine("New balalance is {0}", SeinfeldChecking1.AccountBalance); Console.WriteLine("enter to continue"); Console.ReadLine(); Console.Clear(); } if (choice2 == "2") { Console.WriteLine("How much to withdraw?"); withdraw = double.Parse(Console.ReadLine()); if (withdraw > SeinfeldSavings1.AccountBalance) { Console.WriteLine("insufficient funds"); Console.WriteLine("enter"); Console.ReadLine(); Console.Clear(); break; } SeinfeldSavings1.AccountBalance = SeinfeldSavings1.Withdraw(withdraw); Console.WriteLine("new balance is {0}", SeinfeldSavings1.AccountBalance); Console.ReadLine(); Console.Clear(); } if (choice2 == "3") { break; } if (choice2 == "4") { break; } { if (choice1 == "5") { ; } } } while (choice2 != "1" || choice2 != "2" || choice2 != "3" || choice2 != "4"); } } while (choice1 != "5"); } } }
static void Main(string[] args) { Client client1 = new Client("\nJohn Francis Donaghy", "123 Broadway Ave., New York, NY", "212-555-0011"); Checking checking = new Checking(5000, 50000); Savings savings = new Savings(50000, 55000); string makeTransaction = "Y"; string makeTransactionAny = makeTransaction.ToUpper(); do { Console.WriteLine("Welcome To Console Bank \nHow can we help you today? "); Console.WriteLine("\n1. View Client Information"); Console.WriteLine("\n2. View Account Balance"); Console.WriteLine("\n3. Deposit Funds"); Console.WriteLine("\n4. Withdraw Funds"); Console.WriteLine("\n5. Exit"); Console.WriteLine("\n[Type in number for selection and press ENTER]: "); //1 int userSelect = int.Parse(Console.ReadLine()); while (userSelect < 1 || userSelect > 5) { Console.WriteLine("Please select a valid option: "); userSelect = int.Parse(Console.ReadLine()); } if (userSelect == 1) { client1.ClientInfo(); Console.WriteLine(); makeTransactionAny = Transaction(); Console.Clear(); } else if (userSelect == 5) { Console.WriteLine("Thanks for banking with us. \n"); Environment.Exit(0); } //2 else if (userSelect == 2) { Console.WriteLine("\n1. Checking \n2. Savings \n[Type in number for selection and press ENTER]: "); int userSub1 = int.Parse(Console.ReadLine()); if (userSub1 == 1) { Console.WriteLine("\nYour balance is: $" + checking.GetCheckBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } else if (userSub1 == 2) { Console.WriteLine("\nYour balance is: $" + savings.GetSavBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } } //3 else if (userSelect == 3) { Console.WriteLine("\nWhich account? \n1. Checking \n2. Savings \n[Type in number for selection and press ENTER]: "); int userResponse03 = int.Parse(Console.ReadLine()); if (userResponse03 == 1) { Console.WriteLine("\nTotal to deposit into checking: "); double checkDeposit = double.Parse(Console.ReadLine()); checking.Deposit(checkDeposit); Console.WriteLine("\nNew checking balance: $" + checking.GetCheckBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } else if (userResponse03 == 2) { Console.WriteLine("\nTotal to deposit into savings: "); double depositSavings = double.Parse(Console.ReadLine()); savings.Deposit(depositSavings); Console.WriteLine("\nNew savings balance: $" + savings.GetSavBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } } //4 else if (userSelect == 4) { Console.WriteLine("\nWhich account? \n1. Checking \n2. Savings \n[Type in number for selection and press ENTER]: "); int userResponse04 = int.Parse(Console.ReadLine()); if (userResponse04 == 1) { Console.WriteLine("\nTotal withdrawl from checking: "); double withdrawlChecking = double.Parse(Console.ReadLine()); checking.Withdrawl(withdrawlChecking); Console.WriteLine("\nNew checking balance: $" + checking.GetCheckBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } else if (userResponse04 == 2) { Console.WriteLine("\nTotal withdrawl from savings: "); double withdrawlSavings = double.Parse(Console.ReadLine()); savings.Withdrawl(withdrawlSavings); Console.WriteLine("\nNew savings balance: $" + savings.GetSavBal().ToString("N2")); makeTransactionAny = Transaction(); Console.Clear(); } //5 else if (userSelect == 5) { Console.WriteLine("\nThanks for banking with Console Bank! \nHave a nice day."); Environment.Exit(0); } } } while (makeTransactionAny == "Y"); }
static void Main(string[] args) { //Global Variables int checkNum = 10021; int saveNum = 10022; int tempParse; int menuSel; string firstName = "Pete"; string lastName = "Fittante"; string address = "111 Kremlin dr"; string emailAddress = "*****@*****.**"; string phone = "696-kidz"; string password = "******"; string username = "******"; string acctTypeCheck = "Checking"; string acctTypeSaveing = "Saving"; double checkBal = 1000.00; double savingBal = 500.00; double checkDep = 0.00; double savingDep = 0; double savingWD = 0; double checkingWD = 0; bool exitProgram = true; // Class objects instantiated Client client1 = new Client(firstName, lastName, address, emailAddress, phone); Account client01 = new Account(checkNum, saveNum, acctTypeCheck, savingBal, checkBal, checkDep, checkingWD, savingDep, savingWD); Checking firstDep = new Checking(checkBal, checkDep, checkNum, checkingWD, acctTypeCheck); Saving firstSav = new Saving(savingBal, savingDep, saveNum, savingWD, acctTypeSaveing); Access firstAccess = new Access(password, username, exitProgram); //Call Access method to validate user crendentials firstAccess.CredentialsCheck(); //Sets the exitProgram = to false. Not sure why I had to do this. I thought returning //the value in a get method would work. exitProgram = firstAccess.GetExitProgram(); Console.Clear(); //Begginning of Part One project requirements //This while loop controls the entire application. Next time I would have created a menu object //but just didnt have the time. while (exitProgram == false) { //This first section will solicit buisness from the user Console.Write("\n\t\tWelcome to The Third National Bank of Uganda\n\n"); Console.Write("\t\t Your money is almost safe with us!\n\n"); Console.Write("********************************************************************************\n\n"); Console.Write("\n\t\tPlease select 1-5 from the following menu items\n\n"); Console.Write("\n1. View Client Information\n"); Console.Write("\n2. View Account Balance\n"); Console.Write("\n3. Deposit Funds\n"); Console.Write("\n4. Withdraw Funds\n"); Console.Write("\n5. Exit\n\n"); String menuSelStr = Console.ReadLine().ToUpper(); while (int.TryParse(menuSelStr, out tempParse) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelStr = Console.ReadLine().ToUpper(); ExitMethod(menuSelStr); if (int.TryParse(menuSelStr, out tempParse) == true) { menuSel = tempParse; } } menuSel = int.Parse(menuSelStr); //Submenu for customer information switch (menuSel) { case 1: Console.Clear(); client1.InformationMenuMethod(); break; case 2: Console.Clear(); int menuSelAccountInfo; Console.Write("\n\t\tAccount information Menu\n\n"); Console.Write("\n\t\tPlease select 1-2 from the following menu items\n\n"); Console.Write("\n1. Checking information\n"); Console.Write("\n2. Saving Information\n"); Console.Write("\n3. Return to main menu\n\n"); menuSelStr = Console.ReadLine().ToUpper(); while (int.TryParse(menuSelStr, out tempParse) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelStr = Console.ReadLine().ToUpper(); ExitMethod(menuSelStr); if (int.TryParse(menuSelStr, out tempParse) == true) { menuSelAccountInfo = tempParse; } } menuSelAccountInfo = int.Parse(menuSelStr); //Calls information method based on selection from sub menu above switch (menuSelAccountInfo) { case 1: Console.Clear(); firstDep.InformationMenuMethod(); break; case 2: Console.Clear(); firstSav.InformationMenuMethod(); break; default: Console.Clear(); break; } Console.Clear(); break; case 3: Console.Clear(); //Subment for account deposit int menuSelBalance; Console.Write("\n\t\tAccount Deposit Menu\n\n"); Console.Write("\n\t\tPlease select 1-2 from the following menu items\n\n"); Console.Write("\n1. Deposit into checking\n"); Console.Write("\n2. Deposit into savings\n"); Console.Write("\n3. Return to main menu\n\n"); menuSelStr = Console.ReadLine().ToUpper(); while (int.TryParse(menuSelStr, out tempParse) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelStr = Console.ReadLine().ToUpper(); ExitMethod(menuSelStr); if (int.TryParse(menuSelStr, out tempParse) == true) { menuSelBalance = tempParse; } } menuSelBalance = int.Parse(menuSelStr); //Calls deposit method based on selection from sub menu above switch (menuSelBalance) { case 1: Console.Clear(); string menuSelectStrDbl; double tryParseDbl; double menuSelBalDbl = 0.00; Console.Write("\n\t\tChecking Account Deposit Menu\n\n"); Console.Write("\nEnter the amount you would like to deposit into checking: $ "); menuSelectStrDbl = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDbl, out tryParseDbl) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDbl = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDbl); if (double.TryParse(menuSelectStrDbl, out tryParseDbl) == true) { menuSelBalDbl = double.Parse(menuSelectStrDbl); } } Console.Clear(); menuSelBalDbl = double.Parse(menuSelectStrDbl); checkDep = menuSelBalDbl; firstDep.DepositAmount = checkDep; firstDep.SetDepositAmt(); firstDep.GetCheckAddDeposit(); firstDep.InformationMenuMethod(); break; case 2: Console.Clear(); string menuSelectStrDblSav; double tryParseDblSav; double menuSelBalDblSav = 0.00; Console.Write("\n\t\tSaving Account Deposit Menu\n\n"); Console.Write("\nEnter the amount you would like to deposit into savings: $ "); menuSelectStrDblSav = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDblSav, out tryParseDblSav) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDblSav = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDblSav); if (double.TryParse(menuSelectStrDblSav, out tryParseDblSav) == true) { menuSelBalDbl = double.Parse(menuSelectStrDblSav); } } Console.Clear(); menuSelBalDblSav = double.Parse(menuSelectStrDblSav); savingDep = menuSelBalDblSav; firstSav.SavingDepositAmount = savingDep; firstSav.SetDepositAmt(); firstSav.GetSaveAddDeposit(); firstSav.InformationMenuMethod(); break; default: Console.Clear(); break; } Console.Clear(); break; case 4: Console.Clear(); //Sub menu for account withdraw Console.Write("\n\t\tAccount withdraw Menu\n\n"); Console.Write("\n\t\tPlease select 1-2 from the following menu items\n\n"); Console.Write("\n1. Withdraw from checking\n"); Console.Write("\n2. Withdraw from savings\n"); Console.Write("\n3. Return to main menu\n\n"); menuSelStr = Console.ReadLine().ToUpper(); while (int.TryParse(menuSelStr, out tempParse) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelStr = Console.ReadLine().ToUpper(); ExitMethod(menuSelStr); if (int.TryParse(menuSelStr, out tempParse) == true) { menuSelBalance = tempParse; } } menuSelBalance = int.Parse(menuSelStr); //Calls deposit method based on selection from sub menu above switch (menuSelBalance) { case 1: Console.Clear(); string menuSelectStrDbl; double tryParseDbl; double menuSelBalDbl = 0.00; Console.Write("\n\t\tAccount withdraw Menu\n\n"); Console.Write("\nEnter the amount you would like to withdraw from checking: $ "); menuSelectStrDbl = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDbl, out tryParseDbl) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDbl = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDbl); if (double.TryParse(menuSelectStrDbl, out tryParseDbl) == true) { menuSelBalDbl = double.Parse(menuSelectStrDbl); } } menuSelBalDbl = double.Parse(menuSelectStrDbl); Console.WriteLine(checkBal); Console.WriteLine(menuSelectStrDbl); //while loop ensures enough funds in the account to withdraw request funds while ((firstDep.GetCheckBalance() - menuSelBalDbl) < 0) { Console.Clear(); Console.WriteLine(menuSelectStrDbl); Console.WriteLine(checkBal); Console.Write("\n\nYou do not have enough funds in your checking account\n\n"); Console.Write("\nYour current checking account balance is: $ " + firstDep.GetCheckBalance()); Console.Write("\n\n\nPlease select an amount less then: $ " + firstDep.GetCheckBalance() + " : "); menuSelectStrDbl = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDbl, out tryParseDbl) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDbl = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDbl); if (double.TryParse(menuSelectStrDbl, out tryParseDbl) == true) { menuSelBalDbl = double.Parse(menuSelectStrDbl); } } menuSelBalDbl = double.Parse(menuSelectStrDbl); } Console.Clear(); checkingWD = menuSelBalDbl; firstDep.WithdrawAmount = checkingWD; firstDep.SetWithdrawAmt(); firstDep.CheckAcctWithdraw(); firstDep.InformationMenuMethod(); break; case 2: Console.Clear(); string menuSelectStrDblSav; double tryParseDblSav; double menuSelBalDblSav = 0.00; Console.Write("\n\t\tAccount withdraw Menu\n\n"); Console.Write("\nEnter the amount you would like to withdraw from savings: $ "); menuSelectStrDblSav = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDblSav, out tryParseDblSav) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDblSav = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDblSav); if (double.TryParse(menuSelectStrDblSav, out tryParseDblSav) == true) { menuSelBalDblSav = double.Parse(menuSelectStrDblSav); } } Console.Clear(); //if statement and while loop ensures request withdraw funds from the saving //account are sufficient and do not exceed the minium balance requirement menuSelBalDblSav = double.Parse(menuSelectStrDblSav); Console.WriteLine(firstSav.GetSaveBalance()); Console.WriteLine(menuSelBalDblSav); while ((firstSav.GetSaveBalance() - menuSelBalDblSav) <= 150) { Console.Clear(); Console.Write("\n\nA withdraw from your saving account in the amount of: ${0} \n\n", menuSelBalDblSav); Console.Write("\nwill place your saving account balance below the minimum balance limit of $150.00"); Console.Write("\nYour current saving account balance is: $" + savingBal); Console.Write("\n\n\nPlease select an amount less then or equal to: ${0} :", Math.Abs(savingBal - 150)); menuSelectStrDbl = Console.ReadLine().ToUpper(); while (double.TryParse(menuSelectStrDbl, out tryParseDblSav) == false) { Console.Write("Please enter a valid number or exit to quit: "); menuSelectStrDbl = Console.ReadLine().ToUpper(); ExitMethod(menuSelectStrDbl); if (double.TryParse(menuSelectStrDbl, out tryParseDblSav) == true) { menuSelBalDblSav = double.Parse(menuSelectStrDbl); } } menuSelBalDblSav = double.Parse(menuSelectStrDbl); } Console.Clear(); savingWD = menuSelBalDblSav; firstSav.SavingWithdrawAmount = savingWD; firstSav.SetWithdrawAmt(); firstSav.SaveAcctWithdraw(); firstSav.InformationMenuMethod(); break; default: Console.Clear(); break; } Console.Clear(); break; //Allows user exit code based on selection from sub menu above case 5: Console.Clear(); Console.Write("Are you sure you want to exit? Please type exit to confirm: "); string confirm = Console.ReadLine().ToUpper(); if (confirm == "EXIT") { Console.Clear(); Console.WriteLine("\n\n\n\nThank you for using The Third National Bank of Uganda Online Banking Portal"); Console.WriteLine("\n\n KWAHERI\n\n\n\n\n\n\n\n"); exitProgram = true; break; } else { Console.Clear(); continue; } default: Console.Clear(); Console.WriteLine("Please enter a number between 1-5"); break; } } }
static void Main(string[] args) { Savings DGilbertSavings = new Savings("Dan", "Gilbert", "savings", "1029384756", 4700000000); Checking DGilbertChecking = new Checking("Dan", "Gilbert", "checking", "1290347856", 20000000); Reserve DGilbertReserve = new Reserve("Dan", "Gilbert", "reserve", "2109438765", 12500000); while (true) { Console.Clear(); Console.WriteLine("Hello Dan Gilbert,\n\nPlease choose an account below:\n\n"); Console.WriteLine("Checking Account \t[Enter \"1\"]"); Console.WriteLine("Reserve Account \t[Enter \"2\"]"); Console.WriteLine("Savings Account \t[Enter \"3\"]"); Console.WriteLine("Exit \t\t\t[Enter \"0\"]"); int accChoice = int.Parse(Console.ReadLine()); if (accChoice == 1) { Console.Clear(); DGilbertChecking.DisplayAccountInfo("checking"); Console.WriteLine("Account Summary [Enter \"1\"]"); Console.WriteLine("Deposit \t[Enter \"2\"]"); Console.WriteLine("Withdraw \t[Enter \"3\"]"); int accAction = int.Parse(Console.ReadLine()); if (accAction == 1) { Console.Clear(); Console.WriteLine(DGilbertChecking.AccountSummary("DGilbertChecking")); Console.ReadLine(); } else if (accAction == 2) { DGilbertChecking.Deposit(); } else if (accAction == 3) { DGilbertChecking.Withdraw(); } } else if (accChoice == 2) { Console.Clear(); DGilbertChecking.DisplayAccountInfo("reserve"); Console.WriteLine("Account Summary [Enter \"1\"]"); Console.WriteLine("Deposit \t[Enter \"2\"]"); Console.WriteLine("Withdraw \t[Enter \"3\"]"); int accAction = int.Parse(Console.ReadLine()); if (accAction == 1) { Console.Clear(); Console.WriteLine(DGilbertReserve.AccountSummary("DGilbertReserve")); Console.ReadLine(); } else if (accAction == 2) { DGilbertReserve.Deposit(); } else if (accAction == 3) { DGilbertReserve.Withdraw(); } } else if (accChoice == 3) { Console.Clear(); DGilbertChecking.DisplayAccountInfo("savings"); Console.WriteLine("Account Summary [Enter \"1\"]"); Console.WriteLine("Deposit \t[Enter \"2\"]"); Console.WriteLine("Withdraw \t[Enter \"3\"]"); int accAction = int.Parse(Console.ReadLine()); if (accAction == 1) { Console.ReadLine(); Console.WriteLine(DGilbertSavings.AccountSummary("DGilbertSavings")); Console.ReadLine(); } else if (accAction == 2) { DGilbertSavings.Deposit(); } else if (accAction == 3) { DGilbertSavings.Withdraw(); } } else { Environment.Exit(0); } } }
static void Main(string[] args) { bool exitResponse = true; string exitChecker = "no"; Savings savings = new Savings(); Checking checking = new Checking(); List <Checking> checkAcct = new List <Checking>(); while (exitResponse == true) { string[] choiceArray = new string[] { "1. View Client Information", "2. View Account Balance", "3. Deposit Funds", "4. Withdraw Funds", "5. Exit" }; int menuChoice; int accountChoice; Console.WriteLine("Welcome to Local Bank? How can we help you today?"); for (int i = 0; i < choiceArray.Length; i++) { Console.WriteLine(choiceArray[i]); } menuChoice = int.Parse(Console.ReadLine()); switch (menuChoice) { case 1: // Method (Remember to also Call Intrest Method) savings.AddIntrest(); checking.AddIntrest(); break; case 2: Console.WriteLine("Which account would you like to view?"); savings.AddIntrest(); checking.AddIntrest(); bool accountwhile = true; while (accountwhile == true) { accountChoice = int.Parse(Console.ReadLine()); if (accountChoice == 1) { accountwhile = false; } else if (accountChoice == 2) { accountwhile = false; } else { Console.WriteLine("You have made an incorrect choice, please choose again."); } } break; case 3: // Method savings.AddIntrest(); checking.AddIntrest(); Console.WriteLine("Which account would you like to deposit funds into?"); bool accountwhile2 = true; while (accountwhile2 == true) { accountChoice = int.Parse(Console.ReadLine()); if (accountChoice == 1) { accountwhile = false; } else if (accountChoice == 2) { accountwhile = false; } else { Console.WriteLine("You have made an incorrect choice, please choose again."); } } break; case 4: // Method savings.AddIntrest(); checking.AddIntrest(); Console.WriteLine("Which account would you like to withdraw funds from?"); bool accountwhile3 = true; while (accountwhile3 == true) { accountChoice = int.Parse(Console.ReadLine()); if (accountChoice == 1) { accountwhile = false; } else if (accountChoice == 2) { accountwhile = false; } else { Console.WriteLine("You have made an incorrect choice, please choose again."); } } break; case 5: // Method for exit savings.AddIntrest(); checking.AddIntrest(); break; default: Console.WriteLine("You have made an incorrect choice please choose again"); savings.AddIntrest(); checking.AddIntrest(); break; } if (exitChecker.Equals("yes")) { exitResponse = false; } else { Console.WriteLine(); } } }
static void Main(string[] args) { //Instantiate all objects Client greg = new Client(); Checking checking = new Checking(1200.00d, 8645); Savings savings = new Savings(500.00d, 8431); //Set up menu options within loop int choice; Console.WriteLine("Welcome to Cross Roads Bank. Hello " + greg.ClientName); Console.WriteLine("What would you like to do?\n"); 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"); Console.WriteLine(); choice = int.Parse(Console.ReadLine()); while (choice != 5) { if (choice == 1) { greg.ClientInformation(); //Displays information } else if (choice == 2) { Accounts.AccountType(); Console.WriteLine(); int accountType = int.Parse(Console.ReadLine()); if (accountType == 1) { Console.WriteLine(); Console.WriteLine(checking.AccountBalance()); //Checking version of this method } else if (accountType == 2) { Console.WriteLine(); Console.WriteLine(savings.AccountBalance()); //Savings version of this method } } else if (choice == 3) { Accounts.AccountType(); Console.WriteLine(); int accountType = int.Parse(Console.ReadLine()); if (accountType == 1) { Console.WriteLine(); checking.Deposit(); Console.WriteLine(); } else if (accountType == 2) { Console.WriteLine(); savings.Deposit(); Console.WriteLine(); } } else if (choice == 4) { Accounts.AccountType(); Console.WriteLine(); int accountType = int.Parse(Console.ReadLine()); if (accountType == 1) { Console.WriteLine(); checking.Withdraw(); Console.WriteLine(); } else if (accountType == 2) { Console.WriteLine(); savings.Withdraw(); //Savings version of this method Console.WriteLine(); } } //Reiterate before looping back so user can close Console.WriteLine("\nWhat would you like to do?\n"); 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"); Console.WriteLine(); choice = int.Parse(Console.ReadLine()); } Console.WriteLine("\nThank you for banking with Cross Roads Bank! Have a nice day."); }
static void Main(string[] args) { //Instantiate! Client potter = new Client(); Checking check = new Checking(); Savings save = new Savings(); Menu main = new Menu(); float input; //store input numbers string selection; Console.WriteLine("Welcome to Gringott's Bank, sir. How may I be of service?"); do { //View Menu main.MainMenu(); selection = Console.ReadLine().Trim(); //store input if (selection == "1") //client info { Console.WriteLine(potter.GetInfo()); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else if (selection == "2") //Acct balance { do { main.AccountMenu(); selection = Console.ReadLine().Trim(); if (selection == "1") //Show checking balance { Console.WriteLine("Your Checking Account balance is : $" + check.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else if (selection == "2") //show savings balance { Console.WriteLine("Your Savings Account balance is: $" + save.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else { main.ValidationMenu(); } } while (selection != "1" && selection != "2"); } else if (selection == "3") //Deposit funds { do { main.AccountMenu(); selection = Console.ReadLine().Trim(); if (selection == "1") //Deposit to checking { Console.WriteLine("Please enter the amount you'd like to deposit."); input = float.Parse(Console.ReadLine()); check.Deposit(input); Console.WriteLine("Your Checking Account balance is : $" + check.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else if (selection == "2") //Deposit to savings { Console.WriteLine("Please enter the amount you'd like to deposit."); input = float.Parse(Console.ReadLine()); save.Deposit(input); Console.WriteLine("Your Savings Account balance is: $" + save.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else { main.ValidationMenu(); } } while (selection != "1" && selection != "2"); } else if (selection == "4") //Withdraw funds { do { main.AccountMenu(); selection = Console.ReadLine().Trim(); if (selection == "1") //Withdraw from checking { Console.WriteLine("Please enter the amount you'd like to withdraw."); input = float.Parse(Console.ReadLine()); check.Withdraw(input); Console.WriteLine("Your Checking Account balance is : $" + check.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else if (selection == "2") //Withdraw from savings { Console.WriteLine("Please enter the amount you'd like to withdraw."); input = float.Parse(Console.ReadLine()); save.Withdraw(input); Console.WriteLine("Your Savings Account balance is: $" + save.acctBalance); Console.WriteLine("\nCan I do anything else for you, sir?\n"); } else { main.ValidationMenu(); } } while (selection != "1" && selection != "2"); } } while (selection != "5"); { Console.WriteLine("Pleasure doing business with you, Mr. Potter."); Environment.Exit(5); } }
static void Main(string[] args) { Client bill = new Client("Bill Johnson", "3118 Billy Bridge Ln", "216-376-9806"); Savings savings = new Savings(1482306325, 5000.00, "Savings Account"); Checking checking = new Checking(1482306324, 150000.00, "Checking Account"); //View Client Information //View Account Balance //Checking Account Balance //Savings Account Balance //Deposit Funds //To Checking Account //To Savings Account //Withdraw Funds //From Checking Account //From Savings Account //Exit Console.WriteLine(" Welcome to Low Point Bank\n"); Console.WriteLine("Please select a menu option below\n"); Console.WriteLine("1. Check Balance"); Console.WriteLine("2. Deposit Cash"); Console.WriteLine("3. Withdraw Cash"); Console.WriteLine("4. View Account Information"); Console.WriteLine("5. Exit\n"); int selection; selection = int.Parse(Console.ReadLine()); //Must instantiate one client object // Must instantiate one checking account object //Must instantiate one savings account object // All menu options listed above must have functionality behind them // Program should run until user selects 'Exit' if (selection == 1) { string balance; Console.WriteLine("Which Account Balance do you want to view? \n"); Console.WriteLine("1-1. Checking Account Balance"); Console.WriteLine("1-2. Savings Account Balance"); Console.WriteLine("Please enter your selection: "); balance = Console.ReadLine(); if (balance == "1") { Checking checkingBalance = new Checking(1482306324, 150000.00, "Checking"); Console.WriteLine("Your Checking Account Balance is" + checkingBalance); //lost on how to retrieve balances } if (balance == "2") { Savings savingsBalance = new Savings(1482306325, 5000.00, "Savings"); Console.WriteLine("Your Savings Account Balance is " + savingsBalance); } else if (selection == 2) { string deposit; Console.WriteLine("Which Account do you want to deposit cash? \n"); Console.WriteLine("1. Checking"); Console.WriteLine("2. Savings"); Console.WriteLine("Please enter selection: "); deposit = Console.ReadLine(); if (deposit == "1") { Console.WriteLine("Enter your deposit amount: \t$"); double checkingDeposit = int.Parse(Console.ReadLine()); checking.Deposit(); } if (deposit == "2") { Console.WriteLine("Enter your deposit amount: \t$"); double savingsDeposit = int.Parse(Console.ReadLine()); savings.Deposit(); } else if (selection == 3) { string withdraw; Console.WriteLine("Which Account do you want to withdraw from? \n"); Console.WriteLine("1. Checking"); Console.WriteLine("2. Savings"); Console.WriteLine("Please enter selection: "); withdraw = Console.ReadLine(); if (withdraw == "1") { Console.WriteLine("Enter your withdraw amount: "); double checkingWithdraw = int.Parse(Console.ReadLine()); } if (withdraw == "2") { Console.WriteLine("Enter withdraw amount: "); double savingsWithdraw = int.Parse(Console.ReadLine()); } else if (selection == 4) { Console.WriteLine("Client Information" + bill); } else if (selection == 5) { return; } } } } }
static void Main(string[] args) { Checking spend = new Checking(); Reserve shortTerm = new Reserve(); Savings longTerm = new Savings(); int userChoice = 0; do { Console.WriteLine("Welcome to Gringotts Wizard Bank. Please select an option to continue:"); Console.WriteLine("1. View Wizard Information \n2. View vault balance \n3. Deposit Galleons \n4. Withdraw Galleons \n5. Exit"); userChoice = int.Parse(Console.ReadLine()); if (userChoice == 1) //shows client information { spend.getInformation(); } else if (userChoice == 2) //choose an account balance to view { Console.WriteLine("Please choose a balance to view:\n1.Checking\n2.Reserve\n3.Savings"); int option = int.Parse(Console.ReadLine()); if (option == 1) { spend.getBalance(); } else if (option == 2) { shortTerm.getBalance(); } else if (option == 3) { longTerm.getBalance(); } } else if (userChoice == 3) //deposit funds into a section of account { Console.WriteLine("Please choose the section you wish to deposit funds into:\n1.Checking\n2.Reserve\n3.Savings"); int option = int.Parse(Console.ReadLine()); if (option == 1) { spend.Deposit(); } else if (option == 2) { shortTerm.Deposit(); } else if (option == 3) { longTerm.Deposit(); } } else if (userChoice == 4) //withdraw funds from a section of account { Console.WriteLine("Please choose the section you wish to withdraw funds from: \n1. Checking\n2. Reserve\n3. Savings"); int option = int.Parse(Console.ReadLine()); if (option == 1) { spend.Withdraw(); } else if (option == 2) { shortTerm.Withdraw(); } else if (option == 3) { longTerm.Withdraw(); } } else if (userChoice == 5) //quits the program { Environment.Exit(0); } }while (userChoice < 6 && userChoice > 0); StreamWriter saveAccount = new StreamWriter("..\\..\\..Savings.txt"); using (saveAccount) { saveAccount.WriteLine(u) //trying to get the stream writer to work //don't know if it's meant to go here or into each class } }
static void Main(string[] args) { string input, input2, nam, num, balance0, checkbrk0, account_number, dob0, add, ammount0, reciver_number; int balance1 = 0, sran = 100, cran = 100, ammount1; Bank bank = new Bank(5); Label1: Console.WriteLine(); Console.WriteLine("Services of a Bank:\n open\n account\n quit"); Console.WriteLine(); Console.Write("Enter choice: "); input = Console.ReadLine(); switch (input) { case "open": { Console.WriteLine(); Console.WriteLine(" savings\n checking\n quit"); Console.WriteLine(); Console.Write("Enter choice: "); input2 = Console.ReadLine(); if (input2 == "quit") { goto Label1; } else if (input2 == "savings" || input2 == "checking") { Console.Write("Enter your name: "); nam = Console.ReadLine(); Console.Write("Enter your Date of birth: "); dob0 = Console.ReadLine(); Console.Write("Enter your address: "); add = Console.ReadLine(); if (input2 == "savings") { sran++; num = "s-" + sran.ToString(); } else { cran++; num = "c-" + cran.ToString(); } Console.Write("Enter balance: "); balance0 = Console.ReadLine(); balance1 = Convert.ToInt32(balance0); if (input2 == "savings") { Savings sab = new Savings(); sab.Accountname = nam; sab.DateOfBirth = dob0; sab.Address = add; sab.Accountnumber = num; sab.Balance = +balance1; bank.CreateAccount(sab); goto Label1; } else if (input2 == "checking") { Checking ack = new Checking(); ack.Accountname = nam; ack.DateOfBirth = dob0; ack.Address = add; ack.Accountnumber = num; ack.Balance = +balance1; bank.CreateAccount(ack); goto Label1; } } else { break; } goto Label1; } case "account": { Console.Write("Enter your account number: "); account_number = Console.ReadLine(); Label2: Console.WriteLine(); Console.WriteLine(" deposit\n withdraw\n transfer\n change\n show\n quit"); Console.WriteLine(); Console.Write("Enter choice: "); checkbrk0 = Console.ReadLine(); Console.WriteLine(); switch (checkbrk0) { case "quit": break; case "deposit": Console.Write("Enter ammount: "); ammount0 = Console.ReadLine(); ammount1 = Convert.ToInt32(ammount0); bank.Accountdeposit(account_number, ammount1); goto Label2; case "withdraw": Console.Write("Enter ammount: "); ammount0 = Console.ReadLine(); ammount1 = Convert.ToInt32(ammount0); bank.Accountwithdraw(account_number, ammount1); goto Label2; case "transfer": Console.Write("Enter reciver account number: "); reciver_number = Console.ReadLine(); Console.Write("Enter amount: "); ammount0 = Console.ReadLine(); ammount1 = Convert.ToInt32(ammount0); bank.Accounttransfer(account_number, reciver_number, ammount1); goto Label2; case "change": Console.Write("Enter new name: "); reciver_number = Console.ReadLine(); bank.Accountname(account_number, reciver_number); goto Label2; case "show": bank.Accountshow(account_number); goto Label2; default: break; } } goto Label1; case "quit": break; } }
static void Main(string[] args) { //Customer account creation Client shane = new Client("Shane Moodie", "1310 Carol Dr. Kent, Oh", "330-274-7957", 123456789, 98754321); Checking checking = new Checking("Checking Account", 12345789, 500.00); Savings savings = new Savings("Savings Account", 987654321, 2000.00, 200.00); string AB; int menuNavigate; ////Menu Navigation do { //App Main Menu Console.WriteLine("welcome to your virtual bank account! what can we do for you today?\n"); Console.WriteLine("********************"); Console.WriteLine("1.) view client info\n"); Console.WriteLine("2.) view account balance\n"); Console.WriteLine("3.) deposit funds\n"); Console.WriteLine("4.) withdraw funds\n"); Console.WriteLine("5.) cancel transaction and exit"); Console.WriteLine("********************"); menuNavigate = int.Parse(Console.ReadLine()); if (menuNavigate == 1) { shane.ClientInfo(); } else if (menuNavigate == 2) { Console.WriteLine("Please Select Account:\nA.) Checking Account Balance\nB.) Savings Account Balance"); AB = Console.ReadLine().ToUpper(); if (AB == "A") { checking.AccountInfo(); } else if (AB == "B") { savings.AccountInfo(); } } else if (menuNavigate == 3) { Console.WriteLine("Please select account you'd like to deposit to.\nA.) Checking Account\nB.)Savings Account"); AB = Console.ReadLine().ToUpper(); if (AB == "A") { checking.AcctDeposit(); } else if (AB == "B") { savings.AcctDeposit(); } } else if (menuNavigate == 4) { Console.WriteLine("Please select account you'd like to withdraw from.\nA.) Checking Account\nB.) Savings Account"); AB = Console.ReadLine().ToUpper(); if (AB == "A") { checking.AcctWithdraw(); } else if (AB == "B") { savings.AcctWithdraw(); } } if (menuNavigate == 5) { Environment.Exit(0); } }while (true); }
static void Main(string[] args) { //switches backgroung/foreground colors Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.Clear(); //ask client for information Console.WriteLine("Welcome to SSB Bank! What is your first name?\n"); string firstName = Console.ReadLine(); //forces user to input non-integer name //bypasses error if user does not enter a value int value = 0; while (int.TryParse(firstName, out value) || firstName == "") { Console.WriteLine("\nPlease enter a valid name\n"); string firstName2 = Console.ReadLine(); firstName = firstName2; } //capitalizes first letter firstName.ToLower(); firstName = firstName.First().ToString().ToUpper() + firstName.Substring(1); Console.WriteLine("\nPlease enter your last name:\n"); string lastName = Console.ReadLine(); //forces user to input non-integer name //bypasses error if user does not enter a value value = 0; while (int.TryParse(lastName, out value) || lastName == "") { Console.WriteLine("\nPlease enter a valid name\n"); string lastName2 = Console.ReadLine(); lastName = lastName2; } //capitalizes first letter lastName.ToLower(); lastName = lastName.First().ToString().ToUpper() + lastName.Substring(1); Console.WriteLine("\nWhat state do you live in?\n"); string state = Console.ReadLine(); //forces user to input non-integer name //bypasses error if user does not enter a value value = 0; while (int.TryParse(state, out value) || state == "") { Console.WriteLine("\nPlease enter a valid state\n"); string state2 = Console.ReadLine(); state = state2; } //capitalizes state name state = state.ToUpper(); Console.WriteLine("\nWhat city do you live in?\n"); string city = Console.ReadLine(); //forces user to input non-integer name //bypasses error if user does not enter a value value = 0; while (int.TryParse(city, out value) || city == "") { Console.WriteLine("\nPlease enter a valid city\n"); string city2 = Console.ReadLine(); city = city2; } //capitalizes first letter city.ToLower(); city = city.First().ToString().ToUpper() + city.Substring(1); Console.WriteLine("\nPlease enter your email address:\n"); string email = Console.ReadLine(); //bypasses error if user does not enter a value //forces user to enter "@" while (email == "" || email.Contains("@") == false) { Console.WriteLine("\nPlease enter a valid email\n"); string email2 = Console.ReadLine(); email = email2; } //ask client to deposit funds into bank accounts Console.Clear(); Console.WriteLine("\nHello, " + firstName + " " + lastName + "! In order to partner with SSB, you will need to make deposits into your new accounts.\n"); Console.WriteLine("How much would you like to deposit into your Checking Account?\n"); //stores user input as string string chInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(chInput, out value) || chInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string chInput2 = Console.ReadLine(); chInput = chInput2; } //stores user input as integer int chDep = int.Parse(chInput); Console.WriteLine("\nHow much would you like to deposit into your Saving Account?\n"); //stores user input as string string sInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(sInput, out value) || sInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string sInput2 = Console.ReadLine(); sInput = sInput2; } //stores user input as integer int sDep = int.Parse(sInput); Console.WriteLine("\nHow much would you like to deposit into your Reserve Account?\n"); //stores user input as string string rInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(rInput, out value) || rInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string rInput2 = Console.ReadLine(); rInput = rInput2; } //stores user input as integer int rDep = int.Parse(rInput); //generates account numbers Random num = new Random(); int chAcctNumGen = num.Next(10000); int sAcctNumGen = chAcctNumGen + 1; int rAcctNumGen = sAcctNumGen + 1; string checkingAcctNum = "27274662" + chAcctNumGen.ToString(); string savingAcctNum = "27274662" + sAcctNumGen.ToString(); string reserveAcctNum = "27274662" + rAcctNumGen.ToString(); //instantiates account objects in Checking, Saving, Reserve Checking CheckingAccount = new Checking(checkingAcctNum) { AccountNum = checkingAcctNum }; Saving SavingAccount = new Saving(savingAcctNum) { AccountNum = savingAcctNum }; Reserve ReserveAccount = new Reserve(reserveAcctNum) { AccountNum = reserveAcctNum }; //inputs balance into account objects CheckingAccount.CheckingBalance = chDep; SavingAccount.SavingBalance = sDep; ReserveAccount.ReserveBalance = rDep; //instantiaties client object in Account Class Account Client = new Account(); Client.FirstName = firstName; Client.LastName = lastName; Client.City = city; Client.State = state; Client.Email = email; Client.TotalBalance = chDep + sDep + rDep; //instantiate streamwriters StreamWriter CheckingWriter = new StreamWriter("CheckingAccount.txt"); CheckingWriter.WriteLine("Name of Client: " + Client.FullName); CheckingWriter.WriteLine("Checking Account Number: " + CheckingAccount.AccountNum); CheckingWriter.WriteLine(""); CheckingWriter.WriteLine("\tBeginning of Statement Balance: $" + CheckingAccount.CheckingBalance); CheckingWriter.WriteLine(""); StreamWriter SavingWriter = new StreamWriter("SavingAccount.txt"); SavingWriter.WriteLine("Name of Client: " + Client.FullName); SavingWriter.WriteLine("Saving Account Number: " + SavingAccount.AccountNum); SavingWriter.WriteLine(""); SavingWriter.WriteLine("\tBeginning of Statement Balance: $" + SavingAccount.SavingBalance); SavingWriter.WriteLine(""); StreamWriter ReserveWriter = new StreamWriter("ReserveAccount.txt"); ReserveWriter.WriteLine("Name of Client: " + Client.FullName); ReserveWriter.WriteLine("Saving Account Number: " + ReserveAccount.AccountNum); ReserveWriter.WriteLine(""); ReserveWriter.WriteLine("\tBeginning of Statement Balance: $" + ReserveAccount.ReserveBalance); ReserveWriter.WriteLine(""); //clears console before displaying menu items Console.Clear(); while (true) { Menu: Console.Clear(); Console.WriteLine(" ..######...######..########.....########.....###....##....##.##....##"); Console.WriteLine(" .##....##.##....##.##.....##....##.....##...##.##...###...##.##...##."); Console.WriteLine(" .##.......##.......##.....##....##.....##..##...##..####..##.##..##.."); Console.WriteLine(" ..######...######..########.....########..##.....##.##.##.##.#####..."); Console.WriteLine(" .......##.......##.##.....##....##.....##.#########.##..####.##..##.."); Console.WriteLine(" .##....##.##....##.##.....##....##.....##.##.....##.##...###.##...##."); Console.WriteLine(" ..######...######..########.....########..##.....##.##....##.##....##"); Console.WriteLine("\n"); Console.WriteLine("\t1 - View Client Information"); Console.WriteLine("\t2 - View Total Balance"); Console.WriteLine("\t\t3 - Checking"); Console.WriteLine("\t\t4 - Saving"); Console.WriteLine("\t\t5 - Reserve"); Console.WriteLine("\t6 - Deposit Funds"); Console.WriteLine("\t7 - Withdraw Funds"); Console.WriteLine("\t8 - Exit\n"); //stores user input as string string userInput = Console.ReadLine(); //bypasses error if user presses enter without entering value while (userInput == "") { Console.WriteLine("\nPlease enter a valid number"); string userInput2 = Console.ReadLine(); userInput = userInput2; } //bypasses error if user enters a letter value = -1; while (!int.TryParse(userInput, out value)) { Console.WriteLine("\nPlease enter a valid number"); string userInput2 = Console.ReadLine(); userInput = userInput2; } //stores user input as integer int input = int.Parse(userInput); //prevents user from entering values out of range while (input < 1 || input > 8) { Console.WriteLine("\nPlease enter a valid number"); int input2 = int.Parse(Console.ReadLine()); input = input2; } //quit program if (input == 8) { Console.Clear(); CheckingWriter.Close(); SavingWriter.Close(); ReserveWriter.Close(); break; } //actions to be completed based on user input if (input == 1) { Console.Clear(); Client.DisplayInfo(); Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 2) { Console.Clear(); Client.DisplayTotalBalance(); Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 3) { Console.Clear(); CheckingAccount.DisplayBalance(); Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 4) { Console.Clear(); SavingAccount.DisplayBalance(); Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 5) { Console.Clear(); ReserveAccount.DisplayBalance(); Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 6) { Console.Clear(); Console.WriteLine("To which account would you like to make a deposit?\n"); Console.WriteLine("1 - Checking\n2 - Saving\n3 - Reserve\n"); string acctInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(acctInput, out value) || acctInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string acctInput2 = Console.ReadLine(); acctInput = acctInput2; } //stores user input as integer int acct = int.Parse(acctInput); //prevents user from entering values out of range while (acct < 1 || acct > 3) { Console.WriteLine("\nPlease enter a valid number\n"); int acct2 = int.Parse(Console.ReadLine()); acct = acct2; } if (acct == 1) { Console.WriteLine("\nHow much would you like to deposit into your Checking Account?\n"); string depInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(depInput, out value) || depInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string depInput2 = Console.ReadLine(); depInput = depInput2; } //stores user input as integer int dep = int.Parse(depInput); //prevents user from entering values out of range while (dep <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int dep2 = int.Parse(Console.ReadLine()); dep = dep2; } CheckingAccount.Deposit(dep); CheckingAccount.DisplayBalance(); //streamwriter CheckingWriter.WriteLine("\t" + DateTime.Now + "\t" + "(+) $" + dep + "\tUpdated Balance: $" + CheckingAccount.CheckingBalance); } else if (acct == 2) { Console.WriteLine("\nHow much would you like to deposit into your Saving Account?\n"); string depInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(depInput, out value) || depInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string depInput2 = Console.ReadLine(); depInput = depInput2; } //stores user input as integer int dep = int.Parse(depInput); //prevents user from entering values out of range while (dep <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int dep2 = int.Parse(Console.ReadLine()); dep = dep2; } SavingAccount.Deposit(dep); SavingAccount.DisplayBalance(); //streamwriter SavingWriter.WriteLine("\t" + DateTime.Now + "\t" + "(+) $" + dep + "\tUpdated Balance: $" + SavingAccount.SavingBalance); } else if (acct == 3) { Console.WriteLine("\nHow much would you like to deposit into your Reserve Account?\n"); string depInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(depInput, out value) || depInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string depInput2 = Console.ReadLine(); depInput = depInput2; } //stores user input as integer int dep = int.Parse(depInput); //prevents user from entering values out of range while (dep <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int dep2 = int.Parse(Console.ReadLine()); dep = dep2; } ReserveAccount.Deposit(dep); ReserveAccount.DisplayBalance(); //streamwriter ReserveWriter.WriteLine("\t" + DateTime.Now + "\t" + "(+) $" + dep + "\tUpdated Balance: $" + ReserveAccount.ReserveBalance); } Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } else if (input == 7) { Console.Clear(); Console.WriteLine("From which account would you like to make a withdrawal?\n"); Console.WriteLine("1 - Checking\n2 - Saving\n3 - Reserve\n"); string acctInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(acctInput, out value) || acctInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string acctInput2 = Console.ReadLine(); acctInput = acctInput2; } //stores user input as integer int acct = int.Parse(acctInput); //prevents user from entering values out of range while (acct < 1 || acct > 3) { Console.WriteLine("\nPlease enter a valid number\n"); int acct2 = int.Parse(Console.ReadLine()); acct = acct2; } if (acct == 1) { Console.WriteLine("\nHow much would you like to withdraw from your Checking Account?\n"); string withInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(withInput, out value) || withInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string withInput2 = Console.ReadLine(); withInput = withInput2; } //stores user input as integer int with = int.Parse(withInput); //prevents user from entering values out of range while (with <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int with2 = int.Parse(Console.ReadLine()); with = with2; } CheckingAccount.Withdraw(with); CheckingAccount.DisplayBalance(); //streamwriter CheckingWriter.WriteLine("\t" + DateTime.Now + "\t" + "(-) $" + with + "\tUpdated Balance: $" + CheckingAccount.CheckingBalance); } else if (acct == 2) { Console.WriteLine("\nHow much would you like to withdraw from your Saving Account?\n"); string withInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(withInput, out value) || withInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string withInput2 = Console.ReadLine(); withInput = withInput2; } //stores user input as integer int with = int.Parse(withInput); //prevents user from entering values out of range while (with <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int with2 = int.Parse(Console.ReadLine()); with = with2; } SavingAccount.Withdraw(with); SavingAccount.DisplayBalance(); //streamwriter SavingWriter.WriteLine("\t" + DateTime.Now + "\t" + "(-) $" + with + "\tUpdated Balance: $" + SavingAccount.SavingBalance); } else if (acct == 3) { Console.WriteLine("\nHow much would you like to withdraw from your Reserve Account?\n"); string withInput = Console.ReadLine(); //bypasses error if user presses enter without entering value //bypasses error if user enters a letter value = -1; while (!int.TryParse(withInput, out value) || withInput == "") { Console.WriteLine("\nPlease enter a valid number\n"); string withInput2 = Console.ReadLine(); withInput = withInput2; } //stores user input as integer int with = int.Parse(withInput); //prevents user from entering values out of range while (with <= 0) { Console.WriteLine("\nPlease enter a valid number\n"); int with2 = int.Parse(Console.ReadLine()); with = with2; } ReserveAccount.Withdraw(with); ReserveAccount.DisplayBalance(); //streamwriter ReserveWriter.WriteLine("\t" + DateTime.Now + "\t" + "(-) $" + with + "\tUpdated Balance: $" + ReserveAccount.ReserveBalance); } Console.WriteLine("\nPress any key to access main menu...\n"); Console.ReadKey(); goto Menu; } } Console.WriteLine("Thank you for your business.\n"); }