Example #1
0
        static void Main(string[] args)
        {
            // Initial Savings account instance creation
            Savings MySavings = new Savings("00001234", 0.05m);

            MySavings.AccountNumber = "00004321";
            MySavings.AccountHolder = "Mitchell Combs";

            //Initial Checking account creation
            Checking MyChecking = new Checking("0004321", "Mitchell Combs");

            MyChecking.Deposit(1000);
            MyChecking.WriteCheck("denise", 100);
            Console.WriteLine($"Current Checking balance is {MyChecking.Balance}");


            // Initial deposits and withdrawals for method testing
            MySavings.Deposit(1500.00m);
            MySavings.Deposit(3500.00m);
            MySavings.Withdraw(2250.00m);
            MySavings.Deposit(12500.00m);
            MySavings.Withdraw(3277);
            Console.WriteLine($"Current Savings balance is {MySavings.Balance}");

            // Testing method to show total interest paid for the month
            MySavings.InterestPaid(MySavings.Balance);
            Console.WriteLine($"Monthly interest paid is {MySavings.InterestPaid(MySavings.Balance)}");

            // Testing balance + monthly interest paid
            MySavings.AddInterest(MySavings.InterestPaid(MySavings.Balance));
            Console.WriteLine($"Savings Balance after interest is {MySavings.Balance}");

            List <Account> Accounts = new List <Account> {
                MySavings, MyChecking
            };
            decimal TotalAllAccounts = 0;

            foreach (Account accounts in Accounts)
            {
                TotalAllAccounts += accounts.Balance;
            }

            Console.WriteLine($"Total balance of all accounts is {TotalAllAccounts}");
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Bank of WCCI.");
            Console.WriteLine("How may we help you today?");


            while (true)
            {
                Account  AccountInfo    = new Account();
                Account  DepositMoney   = new Account();
                Account  WithdrawMoney  = new Account();
                Checking CheckBalance   = new Checking();
                Savings  SaveBalance    = new Savings();
                Reserve  ReserveBalance = new Reserve();

                //menu that works

                List <string> mainMenu = new List <string>();
                mainMenu.Add("\n");
                mainMenu.Add("Menu");
                mainMenu.Add("Enter 1 to view Account Info");
                mainMenu.Add("Enter 2 for Checking Account Balance");
                mainMenu.Add("Enter 3 for Reserve Account Balance");
                mainMenu.Add("Enter 4 for Savings Account Balance");
                mainMenu.Add("Enter 5 to Make a Deposit");
                mainMenu.Add("Enter 6 to Withdraw from an Account");
                mainMenu.Add("Enter 7 to Exit");

                mainMenu.ForEach(Console.WriteLine);

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

                switch (menuChoice)
                {
                case 1:
                    Console.WriteLine(AccountInfo);
                    break;

                //checking acct balance
                case 2:
                    Console.WriteLine(CheckBalance);

                    break;

                case 3:
                    Console.WriteLine(ReserveBalance);
                    break;

                case 4:
                    Console.WriteLine(SaveBalance);
                    break;

                //deposit
                case 5:
                    Console.WriteLine(DepositMoney);
                    break;

                //withdraw
                case 6:
                    Console.WriteLine(WithdrawMoney);
                    break;

                //exit
                case 7:
                    Environment.Exit(0);
                    break;

                default:
                    break;
                }
            }
        }
Example #3
0
        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");
        }
Example #4
0
        static void Main(string[] args)
        {
            int userChoice = 0;

            //hardcoded user info
            Client user = new Client("Moses Gilford", "mosesgilford", 100001);

            Checking userChecking = new Checking(1000.00);
            Savings  userSavings  = new Savings(10000.00);

            Console.WriteLine("MAIN MENU");
            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 = int.Parse(Console.ReadLine());
            Console.WriteLine();
            //run userchoice loop.
            do
            {
                switch (userChoice)
                {
                case 1:     //Client info
                    user.GetInfo();
                    Console.WriteLine();
                    break;

                case 2:
                    Console.WriteLine("View account information for");
                    Console.WriteLine("1. Checking");
                    Console.WriteLine("2. Savings");
                    userChoice = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    if (userChoice == 1)     //Checking, Accounts base method
                    {
                        userChecking.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 2)     //Savings, Accounts base method
                    {
                        userSavings.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 5)
                    {
                        Console.WriteLine("Thank you");
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("Please enter a valid option");
                        Console.WriteLine();
                    }
                    break;

                case 3:
                    Console.WriteLine("Deposit to");
                    Console.WriteLine("1. Checking");
                    Console.WriteLine("2. Savings");
                    userChoice = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    if (userChoice == 1)
                    {
                        Console.WriteLine("How much would you like to deposit?");
                        double userDeposit = double.Parse(Console.ReadLine());
                        userChecking.Deposit(userDeposit);     //Checking, Accounts Deposit method
                        userChecking.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 2)
                    {
                        Console.WriteLine("How much would you like to deposit?");
                        double userDeposit = double.Parse(Console.ReadLine());
                        userSavings.Deposit(userDeposit);     //Savings, Acounts Deposit method
                        userSavings.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 5)
                    {
                        Console.WriteLine("Thank you");
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("Please enter a valid option");
                        Console.WriteLine();
                    }
                    break;

                case 4:
                    Console.WriteLine("Withdraw from");
                    Console.WriteLine("1. Checking");
                    Console.WriteLine("2. Savings");
                    userChoice = int.Parse(Console.ReadLine());
                    Console.WriteLine();

                    if (userChoice == 1)
                    {
                        Console.WriteLine("How much would you like to withdraw?");
                        double userWithdraw = double.Parse(Console.ReadLine());
                        userChecking.Withdraw(userWithdraw);      //Checking, Accounts base method
                        userChecking.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 2)
                    {
                        Console.WriteLine("How much would you like to withdraw?");
                        double userWithdraw = double.Parse(Console.ReadLine());
                        userSavings.Withdraw(userWithdraw);      //Savings override, Accounts base method
                        userSavings.ViewBalance();
                        Console.WriteLine();
                    }
                    else if (userChoice == 5)
                    {
                        Console.WriteLine("Thank you");
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("Please enter a valid option");
                        Console.WriteLine();
                    }
                    break;

                case 5:
                    Console.WriteLine("Thank you.");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Please enter valid option.");
                    break;
                }


                Console.WriteLine("Need something else?");
                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();

                userChoice = int.Parse(Console.ReadLine());
                if (userChoice == 5)
                {
                    Console.WriteLine("Thank you.");
                }
            }while (userChoice < 5);
        }
Example #5
0
        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);
        }