static void Main(string[] args) { Client Suzy = new Client("Suzy Carmichael ", 191914, 250000000.00d); Checking checking = new Checking(500000, "Checkings", 191915); Saving saving = new Saving(10000, "Savings", 191916); Console.WriteLine("Welcome to White National Bank! How can we assist you?"); string entryCommand; do { Console.WriteLine("1. View Client Information\n2. View Account Balance\n3. Deposit Funds\n4. Withdraw Funds\n5. Exit\n"); entryCommand = Console.ReadLine(); //1. View Client Info if (entryCommand == "1") { Console.WriteLine(Suzy.LogIn()); } //2. View account balance... choose a or b.... //careful of which "balance" you're using... else if (entryCommand == "2") { Console.WriteLine("A. View Balance in Checking...\nB. View Balance in Saving.\nEnter A or B."); string checkBalance = Console.ReadLine().ToUpper(); if (checkBalance == "A") { Console.WriteLine("Your balance is " + checking.TotalBalance + "."); } else if (checkBalance == "B") { Console.WriteLine("Your balance is " + saving.TotalBalance + "."); } } //3. Deposit funds... user input?? else if (entryCommand == "3") { Console.WriteLine("A. Depost funds into checking account....\nB. Deposit funds into savings account.... Enter A or B."); string depositAccount = Console.ReadLine().ToUpper(); // double depositAmount = double.Parse(Console.ReadLine()); // double checkingBalance; if (depositAccount == "A") { Console.WriteLine("Enter the amount you would like to deposit."); double depositAmount = double.Parse(Console.ReadLine()); checking.DepositFunds(); checking.CurrentBalance(); Console.WriteLine("Current balance for your checking account is " + checking.CheckingBalance + " dollars."); } else if (depositAccount == "B") { Console.WriteLine("Enter the amount you would like to deposit."); double depositAmount = double.Parse(Console.ReadLine()); saving.SDepositFunds(); saving.CurrentBalance(); Console.WriteLine("Current balance for your saving account is " + saving.SavingBalance + " dollars."); } } //4. Withdraw funds else if (entryCommand == "4") { Console.WriteLine("A. Withdraw funds from checking account....\nB. Withdraw funds from savings account."); string withdrawAccount = Console.ReadLine().ToUpper(); double withdrawAmount = double.Parse(Console.ReadLine()); if (withdrawAccount == "A") { Console.WriteLine("Enter the amount you would like to withdraw."); checking.WithdrawFunds(); checking.CurrentBalance(); Console.WriteLine("Available balance for your checking account is " + checking.CheckingBalance); } else if (withdrawAccount == "B") { Console.WriteLine("Enter the amount you would like to withdraw."); saving.WithdrawFunds(); saving.CurrentBalance(); Console.WriteLine("Available balance for your savings account is " + saving.SavingBalance); } } //wait no... remember this is still in a huge if-else statement! else { if (entryCommand == "Exit") { saving.Exit(); Environment.Exit(0); } else { Console.WriteLine("Back out of program and try again."); } } }while (entryCommand != "Exit"); }
static void Main(string[] args) { //Instantiate client, checking account, and savings account. //Hard code the client and account information: Client client1 = new Client("Clark", "Howard", 12538); Checking checking1 = new Checking(18735426, 548.23, "checking"); Savings savings1 = new Savings(29957352, 2941.15, "savings", 2500.00); Console.WriteLine("Welcome to Trustus National Bank! Thank you for banking with us.\n"); //Declare variables: int userPick; int userType; //Create and print client menu. Do-while loop allows user to exit the program. Console.WriteLine("\nPlease enter the number of your desired menu option and then click \"Enter\":"); do { List <string> clientMenu = new List <string> { "1. View your user profile.", "2. View your account balance.", "3. Make a deposit.", "4. Make a withdrawal.", "5. Exit." }; foreach (string menuChoice in clientMenu) { Console.WriteLine("\t" + menuChoice); } Console.WriteLine(); userPick = int.Parse(Console.ReadLine()); //Conditionals based on user's pick of menu choice: switch (userPick) { case 1: Console.WriteLine(); client1.PrintClientInfo(); Console.WriteLine("\nWhat would you like to do next?"); break; case 2: do { Console.WriteLine("\nWhat is the account type?\nEnter number of menu option:\n\t1. checking\n\t2. savings\n"); userType = int.Parse(Console.ReadLine()); switch (userType) { case 1: Console.WriteLine(); checking1.PrintBalance(); break; case 2: Console.WriteLine(); savings1.PrintBalance(); break; default: Console.WriteLine("\nPlease enter a valid option."); break; } } while (userType != 1 && userType != 2); Console.WriteLine("\nWhat would you like to do next?"); break; case 3: do { Console.WriteLine("\nInto which account type would you like to make a deposit?\nEnter number of the menu option:\n\t1. checking\n\t2. savings\n"); userType = int.Parse(Console.ReadLine()); switch (userType) { case 1: Console.WriteLine(); checking1.DepositFunds(); break; case 2: Console.WriteLine(); savings1.DepositFunds(); break; default: Console.WriteLine("\nPlease enter a valid option."); break; } } while (userType != 1 && userType != 2); Console.WriteLine("\nWhat would you like to do next?"); break; case 4: do { Console.WriteLine("\nFrom which account type would you like to make a withdrawal?\nEnter the number of the menu option:\n\t1. checking\n\t2. savings\n"); userType = int.Parse(Console.ReadLine()); switch (userType) { case 1: Console.WriteLine(); checking1.WithdrawFunds(); break; case 2: Console.WriteLine(); savings1.WithdrawFunds(); break; default: Console.WriteLine("\nPlease enter a valid option."); break; } } while (userType != 1 && userType != 2); Console.WriteLine("\nWhat would you like to do next?"); break; case 5: Console.WriteLine("\nIt has been a pleasure serving you!\n"); break; default: Console.WriteLine("\nPlease choose a valid option."); break; } } while (userPick != 5); }