Example #1
0
        static void Main(string[] args)
        {
            //Initializing three primary class instances
            Client jack = new Client("Jack Vettriano", "Famed Painter", 300, "6716 Princess Gardens, KnightsBridge, London");

            Savings_Account savings = new Savings_Account(123456, 500, "Savings Account", .005d);

            Checking_Account checking = new Checking_Account(11111111, 200000, "Checking Account");

            //Functional menu created
            string openingCommand;
            string upperOpeningCommand;

            do
            {
                Console.WriteLine("\n1.View Client Information \n2.View Account Balance\n3.Deposit Funds \n4.Withdraw Funds \n5.Exit \n");
                openingCommand      = Console.ReadLine();
                upperOpeningCommand = openingCommand.ToUpper();
                //Console.Clear(); I feel that the console looks much "cleaner" after being cleared, but this interfered with the console format required for this assignment

                //Client Information
                if (upperOpeningCommand == "VIEW CLIENT INFORMATION")
                {
                    Console.WriteLine(jack.ViewInfo());
                }

                //View Account Balance
                else if (upperOpeningCommand == "VIEW ACCOUNT BALANCE")
                {
                    Console.WriteLine("\n2 \na. Checking Account Balance \nb. Savings Account Balance\n");
                    string accountBalance      = Console.ReadLine();
                    string upperAccountBalance = accountBalance.ToUpper();
                    if (upperAccountBalance == "CHECKING ACCOUNT BALANCE")
                    {
                        Console.WriteLine("Your balance is " + checking.GetAccountBalance());
                    }
                    else if ((upperAccountBalance == "SAVINGS ACCOUNT BALANCE"))
                    {
                        Console.WriteLine("Your balance is " + savings.GetAccountBalance());
                    }
                }

                //Deposit Funds
                else if (upperOpeningCommand == "DEPOSIT FUNDS")
                {
                    Console.WriteLine("\n2 \n\na. Savings Account \nb. Checking Account\n");
                    string depositChoice      = Console.ReadLine();
                    string upperDepositChoice = depositChoice.ToUpper();
                    if (upperDepositChoice == "SAVINGS ACCOUNT")
                    {
                        savings.Deposit();
                        Console.WriteLine("The new balance for your savings account is: " + savings.GetAccountBalance());
                    }
                    else if (upperDepositChoice == "CHECKING ACCOUNT")
                    {
                        checking.Deposit();
                        Console.WriteLine("The new balance for your checking account is: " + checking.GetAccountBalance());
                    }
                }

                //Withdraw Funds
                else if (upperOpeningCommand == "WITHDRAW FUNDS")
                {
                    Console.WriteLine("\n2 \n\na. Savings Account \nb. Checking Account\n");
                    string withdrawChoice      = Console.ReadLine();
                    string upperWithdrawChoice = withdrawChoice.ToUpper();
                    if (upperWithdrawChoice == "SAVINGS ACCOUNT")
                    {
                        savings.Withdraw();
                        Console.WriteLine("The new balance for your savings account is: " + savings.GetAccountBalance());
                    }
                    else if (upperWithdrawChoice == "CHECKING ACCOUNT")
                    {
                        checking.Withdraw();
                        Console.WriteLine("The new balance for your checking account is: " + checking.GetAccountBalance());
                    }
                }
                //Exit Program & and invalid command text
                else
                {
                    if (upperOpeningCommand == "EXIT")
                    {
                        savings.Exit();
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("Please type a valid command");
                    }
                }
            } while (upperOpeningCommand != "EXIT");
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello! Welcome to BankWorld. \nWhat would you like to do?");


            Savings_Account  Savings  = new Savings_Account(100, 1000000);
            Checking_Account Checking = new Checking_Account(100, 500000);
            Reserve_Account  Reserve  = new Reserve_Account(100, 100000);



            int selection = 0;

            while (selection != 7)
            {
                Console.Clear();
                Console.WriteLine("Name: Walter White");
                Savings.ShowBalance();
                Checking.ShowBalance();
                Reserve.ShowBalance();
                Console.WriteLine("\t");
                Console.WriteLine("1. Deposit into savings \n2. Withdraw from savings \n3. Deposit into checking \n4. Withdraw from checking \n5. Deposit into reserve \n6. Withdraw from reserve. \n7. Leave BankWorld");

                selection = int.Parse(Console.ReadLine());

                if (selection == 1)
                {
                    Console.WriteLine("How much?");
                    double depositAction = int.Parse(Console.ReadLine());

                    Savings.DepositTrans(depositAction);
                }
                else if (selection == 2)
                {
                    Console.WriteLine("How Much?");
                    double withdrawAction = int.Parse(Console.ReadLine());
                    Savings.WithdrawTrans(withdrawAction);
                }
                else if (selection == 3)
                {
                    Console.WriteLine("How Much?");
                    double depositAction = int.Parse(Console.ReadLine());
                    Checking.DepositTrans(depositAction);
                }
                else if (selection == 4)
                {
                    Console.WriteLine("How much?");
                    double withdrawAction = int.Parse(Console.ReadLine());
                    Checking.WithdrawTrans(withdrawAction);
                }
                else if (selection == 5)
                {
                    Console.WriteLine("How Much?");
                    double depositAction = int.Parse(Console.ReadLine());
                    Reserve.DepositTrans(depositAction);
                }
                else if (selection == 6)
                {
                    Console.WriteLine("How Much?");
                    double withdrawAction = int.Parse(Console.ReadLine());
                    Reserve.WithdrawTrans(withdrawAction);
                }
                else if (selection == 7)
                {
                    Console.WriteLine("Come again soon!");
                    Environment.Exit(0);
                }
                else
                {
                    Console.WriteLine("Sorry...what? Select a correct action please. \"press enter\"");
                }


                if (Savings.Goal >= 100000)
                {
                    Savings.GoalMessage();
                }
                if (Savings.Minimum <= 0)
                {
                    Console.WriteLine("Your savings is empty!");
                    Console.ReadLine();
                }
                if (Checking.Overdraft <= 0)
                {
                    Console.WriteLine("Sorry. You overdrafted. I'm gonna have to fine ya.");
                    Checking.WithdrawTrans(50);
                    Console.ReadLine();
                }
                if (Checking.Maximum >= 500000)
                {
                    Console.WriteLine("What do you do for a living?");
                    Console.ReadLine();
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            // login screen

            Console.WriteLine("Please login by providing your name to determine if you are a member \n of Whatever Bank:");

            // instantiating the needed objects

            Client genericUser = new Client();

            genericUser.UserName = Console.ReadLine();

            Checking_Account checking1 = new Checking_Account();
            Savings_Account  savings1  = new Savings_Account();

            //Generic Coroporate Bank Welcome Screen
            Console.WriteLine("Welcome to Whatever Bank!");

            bool perpetualMenu = true;  // variable necessary for program running until "exit" in do-while loop

            do
            {
                // User Menu

                Console.WriteLine("Please type in the number of your desired action below. \n");
                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");
                int userChoice = int.Parse(Console.ReadLine());

                if (userChoice == 5)
                {
                    perpetualMenu = false;   // to make do-while loop run
                }

                string accountChoice;  // to store input from view account balance, deposit funds, and withdraw funds

                // View Client Info

                if (userChoice == 1)
                {
                    Console.WriteLine();
                    Console.WriteLine(genericUser.UserName);
                    genericUser.GetInfo();
                }

                // View Account Balance

                else if (userChoice == 2)
                {
                    Console.WriteLine();
                    Console.WriteLine("Please type in the letter of the account you would like to view:");
                    Console.WriteLine("a. Checking Account");
                    Console.WriteLine("b. Savings Account");
                    accountChoice = Console.ReadLine();

                    if (accountChoice == "a")
                    {
                        checking1.ViewAccountDetails();
                    }
                    else if (accountChoice == "b")
                    {
                        savings1.ViewAccountDetails();
                    }
                    else
                    {
                        Console.WriteLine("Please choose from a valid selection.");
                    }
                }

                // Deposit Funds

                else if (userChoice == 3)
                {
                    Console.WriteLine();
                    Console.WriteLine("Please type in the letter of the account you would like to make a deposit:");
                    Console.WriteLine("a. Checking Account");
                    Console.WriteLine("b. Savings Account");
                    accountChoice = Console.ReadLine();

                    if (accountChoice == "a")
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please type in the amount you would like to deposit:");
                        checking1.DepositMoney();
                    }
                    else if (accountChoice == "b")
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please type in the amount your would like to deposit:");
                        savings1.DepositMoney();
                    }

                    else
                    {
                        Console.WriteLine("Please choose from a valid selection.");
                    }
                }

                // View Withdraw Funds

                else if (userChoice == 4)
                {
                    Console.WriteLine();
                    Console.WriteLine("Please type in the letter of the account you would like to make a withdrawal:");
                    Console.WriteLine("a. Checking Account");
                    Console.WriteLine("b. Savings Account");
                    accountChoice = Console.ReadLine();

                    if (accountChoice == "a")
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please type in the amount you would like to withdraw:");
                        checking1.WithdrawMoney();
                    }

                    else if (accountChoice == "b")
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please type in the amount your would like to withdraw:");
                        savings1.WithdrawMoney();
                    }

                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Please choose from a valid selection.");
                    }

                    // Exit
                }

                else if (userChoice == 5)
                {
                    Console.WriteLine();
                    Console.WriteLine("Thank you for stopping by Whatever Bank!!!");
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("Please choose from a valid selection.");
                }
            }while (perpetualMenu == true);  // ends do-while loop for program running until "exit"
        }