//Constructors
        public Client(string clientName, double savingsOpen, double checkingOpen, double reserveOpen)    //Using type of account as key for expedience
        {
            ClientName           = clientName;
            ClientAccountNumbers = clientAccountNumbers;
            ClientAccountNumbers.Add("Checking", 1234);
            ClientAccountNumbers.Add("Savings ", 7890);
            ClientAccountNumbers.Add("Reserve ", 2468);

            Checking currentChecking = new Checking(ClientAccountNumbers["Checking"], ClientName, checkingOpen);

            ClientAccounts.Add(1234, currentChecking);

            Savings currentSavings = new Savings(ClientAccountNumbers["Savings "], ClientName, savingsOpen);

            ClientAccounts.Add(7890, currentSavings);

            Reserve currentReserve = new Reserve(ClientAccountNumbers["Reserve "], ClientName, reserveOpen);

            ClientAccounts.Add(2468, currentReserve);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Client   client1         = new Client();
            Checking checkingAccount = new Checking();
            Savings  savingsAccount  = new Savings();

            Console.WriteLine("Welcome to The Bank. You got money in it.");
            Console.WriteLine();
            string mainMenu = "Main Menu \n\n1. View Client Information \n2. View Account Balance \n3. Withdraw Funds \n4. Deposit Funds \n5. Exit\n";

            Console.WriteLine(mainMenu);
            while (true)
            {
                int menuChoice = int.Parse(Console.ReadLine());
                if (menuChoice == 5)
                {
                    Console.WriteLine();
                    Console.WriteLine("Thank you for choosing The Bank.");
                    Console.WriteLine();
                    break;
                }
                else if (menuChoice == 1)
                {
                    client1.ClientInformation();
                    Console.WriteLine();
                    Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                    Console.WriteLine();
                    int infoMenu = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    if (infoMenu == 1)
                    {
                        Console.WriteLine(mainMenu);
                    }
                    else if (infoMenu == 5)
                    {
                        Console.WriteLine("Thank you for choosing The Bank.");
                        Console.WriteLine();
                        break;
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please enter a valid number.");
                        Console.WriteLine();
                        Console.WriteLine(mainMenu);
                        Console.WriteLine();
                    }
                }
                else if (menuChoice == 2)
                {
                    Console.WriteLine();
                    Console.WriteLine("1. Checking Account Balance \n2. Savings Account Balance");
                    Console.WriteLine();
                    int checkAccountBalance = int.Parse(Console.ReadLine());
                    if (checkAccountBalance == 1)
                    {
                        Console.WriteLine();
                        checkingAccount.DisplayAccountType();
                        checkingAccount.DisplayAccountNumber();
                        checkingAccount.DisplayAccountBalance();
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else if (checkAccountBalance == 2)
                    {
                        Console.WriteLine();
                        savingsAccount.DisplayAccountType();
                        savingsAccount.DisplayAccountNumber();
                        savingsAccount.DisplayAccountBalance();
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please enter a valid number.");
                        Console.WriteLine();
                        Console.WriteLine(mainMenu);
                        Console.WriteLine();
                    }
                }
                else if (menuChoice == 3)
                {
                    Console.WriteLine();
                    Console.WriteLine("1. Withdraw from Checking Account \n2. Withdraw from Savings Account");
                    Console.WriteLine();
                    int withdrawFromAccount = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    if (withdrawFromAccount == 1)
                    {
                        Console.WriteLine("How much would you like to withdraw from your checking account today?");
                        Console.WriteLine();
                        double withdrawAmount = double.Parse(Console.ReadLine());
                        checkingAccount.Withdraw(withdrawAmount);
                        while (checkingAccount.AccountBalance < 0)
                        {
                            checkingAccount.Overdraw(withdrawAmount);
                        }
                        if (checkingAccount.AccountBalance > 0)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Your new current balance is ${0}", checkingAccount.AccountBalance);
                        }
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else if (withdrawFromAccount == 2)
                    {
                        Console.WriteLine("How much would you like to withdraw from your savings account today?");
                        Console.WriteLine();
                        double withdrawAmount = double.Parse(Console.ReadLine());
                        Console.WriteLine();
                        savingsAccount.Withdraw(withdrawAmount);
                        while (savingsAccount.AccountBalance < savingsAccount.MinimumBalance)
                        {
                            savingsAccount.Minimum(withdrawAmount);
                        }
                        if (savingsAccount.AccountBalance > savingsAccount.MinimumBalance)
                        {
                            Console.WriteLine("Your new current balance is ${0}", savingsAccount.AccountBalance);
                        }
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please enter a valid number.");
                        Console.WriteLine();
                        Console.WriteLine(mainMenu);
                        Console.WriteLine();
                    }
                }
                else if (menuChoice == 4)
                {
                    Console.WriteLine();
                    Console.WriteLine("1. Deposit into Checking Account \n2. Deposit into Savings Account");
                    Console.WriteLine();
                    int depositIntoAccount = int.Parse(Console.ReadLine());
                    if (depositIntoAccount == 1)
                    {
                        Console.WriteLine();
                        Console.WriteLine("How much would you like to deposit into your checking account today?");
                        Console.WriteLine();
                        double depositAmount = double.Parse(Console.ReadLine());
                        checkingAccount.Deposit(depositAmount);
                        Console.WriteLine();
                        Console.WriteLine("Your new current balance is ${0}", checkingAccount.AccountBalance);
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else if (depositIntoAccount == 2)
                    {
                        Console.WriteLine();
                        Console.WriteLine("How much would you like to deposit into your savings account today?");
                        Console.WriteLine();
                        double depositAmount = double.Parse(Console.ReadLine());
                        savingsAccount.Deposit(depositAmount);
                        Console.WriteLine();
                        Console.WriteLine("Your new current balance is ${0}", savingsAccount.AccountBalance);
                        Console.WriteLine();
                        Console.WriteLine("To return to the Main Menu, press '1'. \nTo Exit, press '5'.");
                        Console.WriteLine();
                        int infoMenu = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                        if (infoMenu == 1)
                        {
                            Console.WriteLine(mainMenu);
                        }
                        else if (infoMenu == 5)
                        {
                            Console.WriteLine("Thank you for choosing The Bank.");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Please enter a valid number.");
                            Console.WriteLine();
                            Console.WriteLine(mainMenu);
                            Console.WriteLine();
                        }
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please enter a valid number.");
                        Console.WriteLine();
                        Console.WriteLine(mainMenu);
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("Please choose from the options listed below.");
                    MainMenu();
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Client   customer         = new Client("Jackie", "Piedra", "*****@*****.**", 54132215);
            Checking customerChecking = new Checking(7806001, 5000m);
            Savings  customerSavings  = new Savings(7806002, 12000m);

            Console.WriteLine("Welcome to Bank Manager, {0}!", customer.FirstName);
            Console.ReadLine();

            int bankAccount;

            bool exit = true;

            do
            {
                MainMenu();
                int userSelection = int.Parse(Console.ReadLine());
                switch (userSelection)
                {
                case 1:
                    customer.CustomerInformation();
                    break;

                case 2:
                    BankAccountSelection();
                    bankAccount = int.Parse(Console.ReadLine());
                    if (bankAccount == 1)
                    {
                        customerChecking.CurrentBalance();
                        ResetToMenu();
                        break;
                    }
                    else if (bankAccount == 2)
                    {
                        customerSavings.CurrentBalance();
                        ResetToMenu();
                        break;
                    }
                    else
                    {
                        Console.WriteLine("\nThat is not a valid entry");
                        ResetToMenu();
                        break;
                    }

                case 3:
                    BankAccountSelection();
                    bankAccount = int.Parse(Console.ReadLine());
                    decimal depositAmount;
                    if (bankAccount == 1)
                    {
                        Console.WriteLine("\nEnter your deposit amount:");
                        depositAmount = decimal.Parse(Console.ReadLine());
                        customerChecking.DepositFunds(depositAmount);
                        customerChecking.CurrentBalance();
                        ResetToMenu();
                        break;
                    }
                    else if (bankAccount == 2)
                    {
                        Console.WriteLine("\nEnter your deposit amount:");
                        depositAmount = decimal.Parse(Console.ReadLine());
                        customerSavings.DepositFunds(depositAmount);
                        customerSavings.CurrentBalance();
                        ResetToMenu();
                        break;
                    }
                    else
                    {
                        Console.WriteLine("\nThat is not a valid entry");
                        ResetToMenu();
                        break;
                    }

                case 4:
                    BankAccountSelection();
                    bankAccount = int.Parse(Console.ReadLine());
                    decimal withdrawalAmount;
                    if (bankAccount == 1)
                    {
                        Console.WriteLine("\nEnter your withdrawal amount:");
                        withdrawalAmount = decimal.Parse(Console.ReadLine());
                        customerChecking.WithdrawFunds(withdrawalAmount);
                        customerChecking.CurrentBalance();
                        ResetToMenu();
                        break;
                    }
                    else if (bankAccount == 2)
                    {
                        if (customerSavings.AccountBalance < customerSavings.MinimumBalance)
                        {
                            Console.WriteLine("You must have a minimum balance of {0:c} in order to withdraw funds", customerSavings.MinimumBalance);
                            Console.WriteLine("Current Account Balance is {0:c}", customerSavings.AccountBalance);
                            ResetToMenu();
                            break;
                        }
                        else
                        {
                            Console.WriteLine("\nEnter your withdrawal amount:");
                            withdrawalAmount = decimal.Parse(Console.ReadLine());
                            customerSavings.WithdrawFunds(withdrawalAmount);
                            customerSavings.CurrentBalance();
                            ResetToMenu();
                            break;
                        }
                    }
                    else
                    {
                        Console.WriteLine("That is not a valid entry");
                        ResetToMenu();
                        break;
                    }

                case 5:
                    Console.WriteLine("Thank you for using Bank Manager!");
                    exit = false;
                    break;

                default:
                    break;
                }
            } while (exit);
        }
        static void Main(string[] args)
        {
            //Objex
            Checking myChecking = new Checking();
            Savings  mySavings  = new Savings();
            Reserve  myReserve  = new Reserve();
            Accounts myAccount  = new Accounts();

            Console.WriteLine("Welcome to The First National Bank of Keith!");
            Console.WriteLine();
            //bool used in do-while loop
            bool cycleAccount = true;

            //do-while loop cycles through program
            do
            {
                Console.WriteLine("Which account would you like to access today?\nChecking, Savings, or Reserve?");
                string accountType = Console.ReadLine();
                accountType = accountType.ToLower();
                if (accountType == "checking") //Checking account functions
                {
                    myChecking.DisplayAccountStats();
                    Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds");
                    Console.WriteLine();
                    string checkingAction = Console.ReadLine();
                    checkingAction = checkingAction.ToLower();
                    if (checkingAction == "withdraw")
                    {
                        myChecking.withdrawMethod(0);
                        myChecking.DisplayAccountStats();
                    }
                    else if (checkingAction == "deposit")
                    {
                        myChecking.depositMethod(0);
                        myChecking.DisplayAccountStats();
                    }
                    else
                    {
                        Console.WriteLine("Error: Invalid response.");
                        Console.WriteLine();
                    }
                }

                else if (accountType == "savings")  //Savings Account functions
                {
                    mySavings.DisplayAccountStats();
                    Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds");
                    Console.WriteLine();
                    string savingsAction = Console.ReadLine();
                    savingsAction = savingsAction.ToLower();
                    if (savingsAction == "withdraw")
                    {
                        mySavings.withdrawMethod(0);
                        mySavings.DisplayAccountStats();
                    }
                    else if (savingsAction == "deposit")
                    {
                        mySavings.depositMethod(0);
                        mySavings.DisplayAccountStats();
                    }
                    else
                    {
                        Console.WriteLine("Error: Invalid response.");
                        Console.WriteLine();
                    }
                }
                else if (accountType == "reserve")  //Reserve Account functions
                {
                    myReserve.DisplayAccountStats();
                    Console.WriteLine("What action would you like to take?\nWithdraw funds\nDeposit funds");
                    Console.WriteLine();
                    string reserveAction = Console.ReadLine();
                    reserveAction = reserveAction.ToLower();
                    if (reserveAction == "withdraw")
                    {
                        myReserve.withdrawMethod(0);
                        myReserve.DisplayAccountStats();
                    }
                    else if (reserveAction == "deposit")
                    {
                        myReserve.depositMethod(0);
                        myReserve.DisplayAccountStats();
                    }
                    else
                    {
                        Console.WriteLine("Error: Invalid response.");
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("Error: Invalid response.");
                    Console.WriteLine();
                }
            } while (cycleAccount == true);


            Console.ReadKey();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Checking checking = new Checking();
            Savings  savings  = new Savings();
            Reserve  reserve  = new Reserve();
            Accounts account1 = new Accounts();

            string clientInput;

            StringBuilder mainMenu = new StringBuilder();

            mainMenu.Append("OurBank Main Menu\n");
            mainMenu.Append("View Client Information, Press '1'\n");
            mainMenu.Append("View Account Balance Information, Press '2'\n");
            mainMenu.Append("To Deposit Funds from checking, Press '3'\n");
            mainMenu.Append("To Withdraw Funds from checking, Press '4'\n");
            mainMenu.Append("To Exit the Application, Press '5'\n");
            mainMenu.Append("Thank you for being a valued OurBank customer!\n");
            mainMenu.Append("Today's Date and time is: " + DateTime.Now + "\n");
            Console.WriteLine(mainMenu.ToString());
            clientInput = Console.ReadLine().ToUpper();
            if (clientInput == "1")
            {
                account1.PrintStats();
            }
            else if (clientInput == "2")
            {
                checking.PrintCheckingStats();
                reserve.PrintReserveStats();
                savings.PrintStats1();
            }
            else if (clientInput == "3")
            {
                checking.Deposit();
            }
            else if (clientInput == "4")
            {
                Console.WriteLine("Do you want to write a check (1), or withdraw from savings (2)?");
                int userResponse = Convert.ToInt32(Console.ReadLine());
                if (userResponse == 1)
                {
                    checking.WriteCheck();
                }
                else
                {
                    savings.Withdraw();
                }
            }
            Console.ReadKey();


            StreamWriter checkingWriter = new StreamWriter("checking.txt");

            using (checkingWriter)
            {
                checkingWriter.Write(DateTime.Now);
            }
            StreamWriter savingsWriter = new StreamWriter("savings.txt");

            using (savingsWriter)
            {
                savingsWriter.Write(DateTime.Now);
            }
            StreamWriter reserveWriter = new StreamWriter("reserve.txt");

            using (reserveWriter)
            {
                reserveWriter.Write(DateTime.Now);
            }
        }
        static void Main(string[] args)
        {
            string userChoice;
            string accountChoice;

            do
            {
                Client   newClient   = new Client();
                Checking newChecking = new Checking();
                Savings  newSavings  = new Savings();

                //Cold open
                Console.WriteLine("Please select the number from the following options:");
                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");

                userChoice = Console.ReadLine().Trim();
                if (userChoice == "1")
                {
                    newClient.GetCustomerInfo();
                }
                else if (userChoice == "2")
                {
                    Console.WriteLine("A Checking");
                    Console.WriteLine("B Savings");
                    accountChoice = Console.ReadLine().ToLower();
                    if (accountChoice == "a")
                    {
                        //Check Balance Checking Account
                        newChecking.IntialBalanceCheck();
                    }
                    else
                    {
                        //check Balance Savings Account
                        newSavings.InitialSavingsCheck();
                    }
                }
                else if (userChoice == "3")
                {
                    Console.WriteLine("A Checking");
                    Console.WriteLine("B Savings");
                    accountChoice = Console.ReadLine().ToLower();
                    if (accountChoice == "a")
                    {
                        //deposit checking funds
                        newChecking.DepositUpdate();
                    }
                    else
                    {
                        //deposit saving funds
                        newSavings.DepositUpdate();
                    }
                }
                else if (userChoice == "4")
                {
                    Console.WriteLine("A Checking");
                    Console.WriteLine("B Savings");
                    accountChoice = Console.ReadLine().ToLower();
                    if (accountChoice == "a")
                    {
                        //deposit checking funds
                        newChecking.CheckingWithdrawUpdate();
                    }
                    else
                    {
                        //deposit saving funds
                        newSavings.CheckinWithdrawUpdate();
                    }
                }
            }while (userChoice == "1" || userChoice == "2" || userChoice == "3" || userChoice == "4");
            if (userChoice == "5")
            {
                Console.WriteLine("Thank you for banking today");
            }
        }