static void Main(string[] args) { Client client1 = new Bank_Account_Project.Client("Razvan", "Crisan", 1234); Savings savings = new Savings(1000.00); Checking checking = new Checking(350.00); //start of the do while loop string newTransaction = ""; do { //When user launches Applicating they will see this menu. //and will cycle after every transaction with a do-while loop double minBalance = 200.00; Console.WriteLine("Please enter the number of your desired option."); 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(); //readline for user to cycle through options. int menuOptions = int.Parse(Console.ReadLine()); //if else statement for first option if (menuOptions == 1) { client1.displayInfo(); } //if else statement for a/b options. if (menuOptions == 2) { Console.WriteLine("a. Checkings Account"); Console.WriteLine("b. Savings Account"); char menuOptions2 = char.Parse(Console.ReadLine().ToLower()); if (menuOptions2 == 'a') { checking.Balance(); } else if (menuOptions2 == 'b') { savings.Balance(); } } //if else statement for option 3 (deposit). if (menuOptions == 3) { Console.WriteLine("Which account would you like to deposit into?"); Console.WriteLine("a. Checkings"); Console.WriteLine("b. Savings"); // char menuOptions2 = char.Parse(Console.ReadLine().ToLower()); if (menuOptions2 == 'a') { //checking deposit Console.WriteLine("Enter deposit amount:"); double depositAmount = double.Parse(Console.ReadLine()); checking.Deposit(); Console.WriteLine("Your new balance is: $" + (checking.Deposit() + depositAmount)); } else if (menuOptions2 == 'b') { //savings deposit Console.WriteLine("Enter deposit amount:"); savings.depositAmount = double.Parse(Console.ReadLine()); double newBalance = savings.Deposit(); Console.WriteLine("Your new balance is: $" + (savings.Deposit())); } } //if else statement for withdraw option 4 if (menuOptions == 4) { Console.WriteLine("Which account would you like to withdraw from?"); Console.WriteLine("a. Checkings"); Console.WriteLine("b. Savings"); char menuOptions2 = char.Parse(Console.ReadLine().ToLower()); if (menuOptions2 == 'a') { //checkings withdraw pulling methods from Checking class Console.WriteLine("Enter withdraw amount:"); checking.withdrawAmount = double.Parse(Console.ReadLine()); double newBalance = checking.Withdraw(); Console.WriteLine("Your new Balance is: $" + checking.Withdraw()); if (newBalance < 0) { //if user pull more money than he has in his account //then user will be prompted to enter new amount //this amount will pull money from his original checking balance. Console.WriteLine("You cannot overdraft from checking."); Console.WriteLine("Enter new withdraw amount"); checking.withdrawAmount = double.Parse(Console.ReadLine()); checking.Withdraw(); Console.WriteLine("Balance after withdraw is: $" + (checking.Withdraw())); } } else if (menuOptions2 == 'b') { //savings withdraw Console.WriteLine("Enter withdraw amount:"); savings.withdrawAmount = double.Parse(Console.ReadLine()); savings.Withdraw(); double newBalance2 = savings.Withdraw(); Console.WriteLine("Balance after withdraw is: $" + (savings.Withdraw())); if (minBalance <= 200.00) { //this amount will not let the user go under their $200 limit //then user will be prompted to enter new amount //this amount will pull money from his original savings balance. Console.WriteLine("You are attempting to withdraw more"); Console.WriteLine("than your minimum balance allows. Please enter new amount"); savings.withdrawAmount = double.Parse(Console.ReadLine()); Console.WriteLine("Balance after withdraw is: $" + (savings.Withdraw())); } } } //if else statement for exit option else if (menuOptions == 5) { Console.WriteLine("Have a great day!"); } //the user will be asked to make another transaction. else { Console.WriteLine("Would you like to make another transaction? YES/NO"); newTransaction = Console.ReadLine().ToUpper(); } } //do-while loop will end program if user selects no while (newTransaction == "YES"); if (newTransaction == "NO") { Console.WriteLine("Thank you for visiting our bank, have a nice day!"); } //The End }
static void Main(string[] args) { string userExit = ""; do { // You are Balthazar Runze and you have 567.45 in your checking and 1243.22 in your savings. Happy banking! //Program will loop and hold values of balances for multiple transactions before exiting //Classes organized as Accounts(abstract) : Clients : Checking/Savings Console.Clear(); Console.WriteLine("Welcome to Crystal Ball Banking, please choose from the following menu choices.\n\n"); Console.WriteLine("1 - View Client Information\n"); Console.WriteLine("2 - View Account Balance\n"); Console.WriteLine("3 - Deposit Funds\n"); Console.WriteLine("4 - Withdraw Funds\n"); Console.WriteLine("5 - Exit\n"); int menuChoice = int.Parse(Console.ReadLine()); //Menu beginning - 5 total choices with 2 choice sub menu for choices 1-4 if (menuChoice == 1) { Client oneClient = new Client(); oneClient.ClientInfo(); //This is a main method that we'll use to return to beginning of menu userExit = backOrExit(); } else if (menuChoice == 2) { //submenu choices - will be the same for menuChoice 2-4 Console.WriteLine("\na - Checking Account\n"); Console.WriteLine("b - Savings Account\n"); string accountChoice = Console.ReadLine().ToLower(); if (accountChoice == "a") { Checking displayBalance = new Checking(); Console.WriteLine(displayBalance.TotalBalance()); } else if (accountChoice == "b") { Savings displayBalance = new Savings(); Console.WriteLine(displayBalance.TotalBalance()); } userExit = backOrExit(); } else if (menuChoice == 3) { Console.WriteLine("\na - Checking Account\n"); Console.WriteLine("b - Savings Account\n"); string accountChoice = Console.ReadLine().ToLower(); Console.WriteLine("\nEnter the amount to Deposit\n"); double userDeposit = double.Parse(Console.ReadLine()); if (accountChoice == "a") { Checking newDeposit = new Checking(userDeposit, 0); Console.WriteLine("\nYour current balance is " + newDeposit.Deposit()); } else if (accountChoice == "b") { Savings newDeposit = new Savings(userDeposit, 0); Console.WriteLine("\nYour current balance is " + newDeposit.Deposit()); } userExit = backOrExit(); } else if (menuChoice == 4) { Console.WriteLine("\na - Checking Account\n"); Console.WriteLine("b - Savings Account\n"); string accountChoice = Console.ReadLine().ToLower(); Console.WriteLine("\nEnter the amount to Withdraw\n"); double userWithdraw = double.Parse(Console.ReadLine()); if (accountChoice == "a") { Checking newWithdraw = new Checking(0, userWithdraw); Console.WriteLine("\nYour current balance is " + newWithdraw.Withdraw()); } else if (accountChoice == "b") { Savings newWithdraw = new Savings(0, userWithdraw); Console.WriteLine("\nYour current balance is " + newWithdraw.WithdrawWithMinimum()); } userExit = backOrExit(); } else if (menuChoice == 5) { Console.WriteLine("\nAre you sure you would like to EXIT this session? YES/NO "); userExit = Console.ReadLine().ToUpper(); } }while (userExit == "NO"); Console.Clear(); Console.WriteLine("Thank you for choosing Crystal Ball Banking. Have a nice day! \n\n"); }
static void Main(string[] args) { int userInput; //declare variable to store user menu selection decimal userWithdrawalAmount; decimal userDepositAmount; Console.WriteLine("Hello, welcome to WCCI Bank. Please enter your first name."); string firstName = (Console.ReadLine()); Console.WriteLine("Please enter your last name"); string lastName = (Console.ReadLine()); string userName = (firstName + " " + lastName); Console.Clear(); Console.WriteLine("Welcome back " + userName); Checking accountc = new Checking(120875, 5000, userName); Savings accounts = new Savings(120875, 10000, userName); Reserve accountr = new Reserve(120875, 1500, userName); do { Console.WriteLine("Here is your current account information:\n"); Console.WriteLine("User ID: {0}", accountc.UserID); Console.WriteLine("Checking Account Balance: {0:C}", accountc.AccountBalance); Console.WriteLine("Reserve Account Balance: {0:C}", accountr.AccountBalance); Console.WriteLine("Savings Account Balance: {0:C}\n\n\n", accounts.AccountBalance); Console.WriteLine("How can we help you today?"); Console.WriteLine("Please enter a number from the menu below. \n"); Console.WriteLine("CHECKING ACCOUNT \n 1: Deposit Funds " + "2: Withdraw Funds " + "3: Show Balance"); Console.WriteLine("RESERVE ACCOUNT \n 4: Deposit Funds " + "5: Withdraw Funds " + "6: Show Balance"); Console.WriteLine("SAVINGS ACCOUNT \n 7: Deposit Funds " + "8: Withdraw Funds " + "9: Show Balance"); Console.WriteLine("VIEW CLIENT INFORMATION: 10 \n \nEXIT: \n 11"); userInput = int.Parse(Console.ReadLine()); if (userInput == 1) //conditional statement that addresses checking deposit. { Console.WriteLine("How much do you want deposit to your checking account?"); userDepositAmount = decimal.Parse(Console.ReadLine()); accountc.Deposit(userDepositAmount); //call method that corresponds with checking deposit Console.WriteLine("Thank you for your deposit!"); Console.WriteLine("Please press any key to return to main menu"); Console.ReadLine(); } else if (userInput == 2) { // conditional statement that addresses checking withdrawal Console.WriteLine("How much do you want to withdraw from your checking account?"); userWithdrawalAmount = decimal.Parse(Console.ReadLine()); accountc.Withdrawal(userWithdrawalAmount); //call method that corresponds with checking withdrawal Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 3) //shows checking account balance { accountc.ShowBalanceChecking(); System.Threading.Thread.Sleep(1000); } else if (userInput == 4) { //conditional statement that addresses reserve account deposit Console.WriteLine("How much do you want deposit to your reserve account?"); userDepositAmount = decimal.Parse(Console.ReadLine()); accountr.Deposit(userDepositAmount); //call method that corresponds to reserve deposit Console.WriteLine("Thank you for your deposit!"); Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 5) { //conditional statement that addresses reserve account withdrawal Console.WriteLine("How much do you want to withdraw from your reserve account?"); userWithdrawalAmount = decimal.Parse(Console.ReadLine()); accountr.Withdrawal(userWithdrawalAmount); //call method that corresponds to reserve withdrawal Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 6) //shows reserve account balance { accountr.ShowBalanceReserve(); Console.ReadLine(); } else if (userInput == 7) { //conditional statement that addresses savings account deposit Console.WriteLine("How much do you want deposit to your savings account?"); userDepositAmount = decimal.Parse(Console.ReadLine()); accounts.Deposit(userDepositAmount); //call method that corresponds to savings deposit Console.WriteLine("Thank you for your deposit!"); Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 8) { //conditional statement that addresses savings account withdrawal Console.WriteLine("How much do you want to withdraw?"); userWithdrawalAmount = decimal.Parse(Console.ReadLine()); accounts.Withdrawal(userWithdrawalAmount); //call method that corresponds to savings withdrawal Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 9) { accounts.ShowBalanceSavings(); Console.ReadLine(); } else if (userInput == 10) { //conditional statement that displays client information Console.Clear(); Console.WriteLine("\n\n\nCLIENT NAME: " + userName + "\nUSER ID:" + accountc.UserID + "\nADDRESS: 120875 Happy Lane, Cleveland, OH 44120 \nACCOUNTHOLDER SINCE: 2010"); System.Threading.Thread.Sleep(4000); Console.WriteLine("Please press enter to return to main menu"); Console.ReadLine(); } else if (userInput == 11) { //conditional statement that calls method to quit the program accountc.Quit(); } else { //conditional statement that addresses answers that don't fall between numbers 1-11 Console.WriteLine("Sorry, I don't understand this selection. "); Console.WriteLine("Please press enter to return to the main menu"); Console.ReadLine(); } } while (userInput != 11); }