static void Main(string[] args) { //OBJECT INSTANTIATING Account client = new Account(); //establishing our one client Checking checking = new Checking(2000); //checking account checking.AccountNumb(); Reserve reserve = new Reserve(500);//reserve account reserve.AccountNumb(); Savings savings = new Savings(18000);//savings account savings.AccountNumb(); //CLIENT AND ACCOUNT NAME STRING PARAMETERS FOR STREAMWRITER string streamcheckingaccount = ("Account Number: " + checking.AcctNumber); string streamreserveaccount = ("Account Number: " + reserve.AcctNumber); string streamsavingsaccount = ("Account Number: " + savings.AcctNumber); string streamclientinfo = (client.ClientInfo()); string checkingaccounttype = (checking.AccountType); string reserveaccounttype = (reserve.AccountType); string savingsaccounttype = (savings.AccountType); using (StreamWriter checkingsummary = new StreamWriter("CheckingSummary.txt", true)) { checkingsummary.WriteLine(checkingaccounttype); checkingsummary.WriteLine(streamclientinfo); checkingsummary.WriteLine(streamcheckingaccount); } using (StreamWriter reservesummary = new StreamWriter("ReserveSummary.txt", true)) { reservesummary.WriteLine(reserveaccounttype); reservesummary.WriteLine(streamclientinfo); reservesummary.WriteLine(streamreserveaccount); } using (StreamWriter savingsummary = new StreamWriter("SavingsSummary.txt", true)) { savingsummary.WriteLine(savingsaccounttype); savingsummary.WriteLine(streamclientinfo); savingsummary.WriteLine(streamcheckingaccount); } bool test = false;//way to break out of menu do-while loop do { //PARAMETERS FOR STREAMWRITER THAT ARE TO BE DONE INSIDE OF THE LOOP string checkingDepositPara = ($"Transaction: +${checking.Deposit} at {DateTime.Now.ToString()} Current Balance: ${checking.Bal}"); string checkingWithdrawalPara = ($"Transaction: -${checking.Withdrawal} at {DateTime.Now.ToString()} Current Balance: ${checking.Bal}"); string reserveDepositPara = ($"Transaction: +${reserve.Deposit} at {DateTime.Now.ToString()} Current Balance: ${reserve.Bal}"); string reserveWithdrawalPara = ($"Transaction: -${reserve.Withdrawal} at {DateTime.Now.ToString()} Current Balance: ${reserve.Bal}"); string savingsDepositPara = ($"Transaction: +${savings.Deposit} at {DateTime.Now.ToString()} Current Balance: ${savings.Bal}"); string savingsWithdrawalPara = ($"Transaction: -${savings.Withdrawal} at {DateTime.Now.ToString()} Current Balance: ${savings.Bal}"); //INSTANTIATING STREAMWRITER FILES //checking using (StreamWriter checkingAccountStreamSummary = new StreamWriter("CheckingSummary.txt", true)) { if (checking.Deposit > 0) { checkingAccountStreamSummary.WriteLine(checkingDepositPara); checking.Deposit = 0; } if (checking.Withdrawal > 0) { checkingAccountStreamSummary.WriteLine(checkingWithdrawalPara); checking.Withdrawal = 0; } } //reserve using (StreamWriter reserveAccountStreamSummary = new StreamWriter("ReserveSummary.txt", true)) { if (reserve.Deposit > 0) { reserveAccountStreamSummary.WriteLine(reserveDepositPara); reserve.Deposit = 0; } if (reserve.Withdrawal > 0) { reserveAccountStreamSummary.WriteLine(reserveWithdrawalPara); reserve.Withdrawal = 0; } } //savings using (StreamWriter savingsAccountStreamSummary = new StreamWriter("SavingsSummary.txt", true)) { if (savings.Deposit > 0) { savingsAccountStreamSummary.WriteLine(savingsDepositPara); savings.Deposit = 0; } if (savings.Withdrawal > 0) { savingsAccountStreamSummary.WriteLine(savingsWithdrawalPara); savings.Withdrawal = 0; } } //MENU ONLINE BANKING-- this menu is a do-while loop with a nested switch statement. //Choices are Client Info, Account Info for each account type, Deposit (for each), Withdrawal (for each), or Exit. Console.WriteLine("Hit Enter to Display Banking Menu"); Console.ReadLine(); client.DisplayMenu(); //the online banking menu string userchoice = Console.ReadLine(); //user input from menu options switch (userchoice.ToUpper()) { case "1": //Display Client Info Console.Clear(); Console.WriteLine(client.ClientInfo()); break; case "2A": //Display Checking Account Balance Console.Clear(); checking.Balance(); Console.WriteLine("Checking Account Balance: $" + checking.Bal); break; case "2B": //Display Checking Account Balance Console.Clear(); reserve.Balance(); Console.WriteLine("Reserve Account Balance: $" + reserve.Bal); break; case "2C": //Display Savings Account Balance Console.Clear(); savings.Balance(); Console.WriteLine("Savings Account Balance: $" + savings.Bal); break; case "3A": //Checking Account Deposit Console.Clear(); Console.WriteLine("How much would you like to deposit?"); checking.Deposit = double.Parse(Console.ReadLine()); Console.WriteLine("You deposited: $" + checking.Deposit); checking.DepositBalance(checking.Deposit); break; case "3B": Console.Clear(); //Reserve Account Deposit Console.WriteLine("How much would you like to deposit?"); reserve.Deposit = double.Parse(Console.ReadLine()); Console.WriteLine("You deposited: $" + reserve.Deposit); reserve.DepositBalance(reserve.Deposit); break; case "3C": Console.Clear(); //Savings Account Deposit Console.WriteLine("How much would you like to deposit?"); savings.Deposit = double.Parse(Console.ReadLine()); Console.WriteLine("You deposited: $" + savings.Deposit); savings.DepositBalance(savings.Deposit); break; case "4A": //Checking Account Withdrawal Console.Clear(); Console.WriteLine("How much would you like to withdraw?"); checking.Withdrawal = double.Parse(Console.ReadLine()); Console.WriteLine("You withdrew: $" + checking.Withdrawal); checking.WithBalance(checking.Withdrawal); break; case "4B": Console.Clear(); //Reserve Account Withdrawal Console.WriteLine("How much would you like to withdraw?"); reserve.Withdrawal = double.Parse(Console.ReadLine()); Console.WriteLine("You withdrew: $" + reserve.Withdrawal); reserve.WithBalance(reserve.Withdrawal); break; case "4C": Console.Clear(); //Savings Account Withdrawal Console.WriteLine("How much would you like to withdraw?"); savings.Withdrawal = double.Parse(Console.ReadLine()); Console.WriteLine("You withdrew: $" + savings.Withdrawal); savings.WithBalance(savings.Withdrawal); break; case "5": Console.Clear(); //Exit Banking Console.WriteLine("You have chosen to exit the online banking. Thanks and come again!"); Environment.Exit(0); break; default: //catch all, breaks the loop Console.Clear(); test = false; break; } } while (!test); }
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); }