Exemplo n.º 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}");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Account samsuzzaman = new Savings("Samsuzzaman", "001", 5000.0f);
            Account tanvir      = new Current("Tanvir", "002", 2000f);
            Account zaman       = new Fixed("Zaman", "003", 1000f, 2015, 10);

            Account ss = new SuperSavings("Joy", "004", 100f);

            ss.Deposit(80);
            ss.ShowInfo();

            Account overdraft = new Overdraft("Abid", "005", 1000f, 5000);

            overdraft.Transfer(ss, 5000);
            overdraft.Deposit(10000);
            overdraft.ShowInfo();
            overdraft.showAllTransaction();

            Customer customer = new Customer("Samsuzzaman Tanvir");

            tanvir.Deposit(10000);
            tanvir.Transfer(samsuzzaman, 5000);
            tanvir.showAllTransaction();

            samsuzzaman.ShowInfo();
            samsuzzaman.Deposit(2000f);
            samsuzzaman.Transfer(tanvir, 4000);
            samsuzzaman.Withdraw(3000);
            samsuzzaman.showAllTransaction();

            //zaman.Deposit(5000);
            //zaman.Withdraw(1000);
            //zaman.ShowInfo();

            //samsuzzaman.Transfer(tanvir, 1000f);
            //tanvir.ShowInfo();

            //customer.AddAccount(samsuzzaman, tanvir);
            //customer.AccDetails();
        }
Exemplo n.º 3
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;
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }