static void Main(string[] args) { //username, password, account List <ATM> accounts = new List <ATM> { new ATM("brian", "ab1234", 100), new ATM("kyle", "america11", 500) }; accounts = new List <string>(); Console.WriteLine("Welcome to the Grand Circus ATM!"); Console.WriteLine(" 1. Register \n 2. Login\n 3. Quit"); string menuSelection = ""; bool tryAgain = true; while (tryAgain) { string userInput = Console.ReadLine().ToLower(); tryAgain = false; switch (userInput) { case "1": case "register": menuSelection = "register"; break; case "2": case "login": menuSelection = "login"; break; case "3": case "quit": break; default: tryAgain = true; Console.WriteLine("Invalid. Please enter a valid entry number from the menu."); break; } } if (menuSelection == "1" || menuSelection == "register") { ATM.ListOutList(accounts); //ATM.GetUsername("Please create your username: "******"Please create your password: "******"Thank you for registering! Please select an option from the menu: "); Console.WriteLine(" 1. Login \n 2. Quit"); menuSelection = ""; string userInput = Console.ReadLine().ToLower(); switch (userInput) { case "1": case "login": menuSelection = "login"; break; case "2": case "quit": menuSelection = "quit"; break; } } if (menuSelection == "1" || menuSelection == "login") { } }
static void Main(string[] args) { ATM atm = new ATM(); var currentAccount = new Account(null, null, 0); int userInputInt = 0; do { Console.Clear(); Console.WriteLine("Welcome to Grand Circus Bank!"); Console.WriteLine(); Console.WriteLine("[1] Log In"); Console.WriteLine("[2] Create New Account"); Console.WriteLine(); Console.Write("Please Select One of the Above to Continue: "); string userInputString = Console.ReadLine(); if (userInputString == "1") { atm.Login(currentAccount); } else if (userInputString == "2") { atm.Register(); } else { Console.WriteLine("Entry Not Recognized. Hit Enter to Continue."); Console.ReadLine(); continue; } do { Console.Clear(); Console.WriteLine("[1] Deposit Funds"); Console.WriteLine("[2] Withdraw Funds"); Console.WriteLine("[3] Check Balance"); Console.WriteLine("[4] Log Off"); Console.WriteLine(); Console.Write("Please Select One of the Above Options: "); if (int.TryParse(Console.ReadLine(), out userInputInt) && userInputInt > 0 && userInputInt < 5) { switch (userInputInt) { case 1: { atm.Deposit(currentAccount.Balance); break; } case 2: { atm.Withdraw(currentAccount.Balance); break; } case 3: { atm.CheckBalance(currentAccount.Balance); break; } case 4: { atm.Logout(currentAccount); break; } default: break; } } else { Console.WriteLine("Invalid Input. Please Try Again. (Hit Enter to Continue)"); Console.ReadLine(); } } while (userInputInt != 4); } while (true); }