示例#1
0
        public string Menu(string fName, string lName, string accountNum)
        {
            //string response = $"Welcome {fName} {lName}. Your account number is {accountNum}.";
            //return response;
            FName      = fName;
            LName      = lName;
            AccountNum = accountNum;
            string response = "Welcome " + FName + " " + LName + ". " + "Your account number is " + AccountNum + ".";

            Console.WriteLine("Please choose a selection.");
            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 input = int.Parse(Console.ReadLine());

            if (input == 1)
            {
                return(response);
            }
            else if (input == 2)
            {
                Console.WriteLine("Please choose a selection.");
                Console.WriteLine("a. Checking Account.");
                Console.WriteLine("b. Savings Account.");
                string userInput = Console.ReadLine().ToLower();
                if (userInput == "a")
                {
                    CheckingAccount account = new CheckingAccount();
                    Console.WriteLine("Your checking account balance is: $" + account.GetBalance());
                }
            }
            return(response);
        }
示例#2
0
        static void Main(string[] args)
        {
            int selection;

            //Instantiate objects
            Client          johnSmith  = new Client();
            CheckingAccount jsChecking = new CheckingAccount();
            SavingsAccount  jsSavings  = new SavingsAccount();

            //Ask for user input
            Console.WriteLine("Hello and welcome to Lehman Brothers. \nHere you can view your account information.");
            Console.WriteLine("It is 2008 and we promise that subprime lending is always a wise investment.");
            Console.WriteLine("We also guarantee to never file for bankruptcy.");

            do
            {
                Console.WriteLine("\nPlease select from the following options: \n1. View Client Information\n2. View Account Balance\n3. Deposit Funds\n4. Withdraw Funds\n5. Exit");

                //Variables based on user input
                selection = int.Parse(Console.ReadLine());
                char account;

                if (selection == 1)
                {
                    Console.WriteLine(johnSmith.GetClientInfo());
                }
                if (selection == 2)
                {
                    Console.WriteLine("Which account would you like to view the balance of?");
                    Console.WriteLine("Please select:\na. Checking Account\nb. Savings Account");
                    account = char.Parse(Console.ReadLine().ToLower());
                    if (account == 'a')
                    {
                        jsChecking.GetBalance();
                    }
                    if (account == 'b')
                    {
                        jsSavings.GetBalance();
                    }
                }
                if (selection == 3)
                {
                    Console.WriteLine("To which account would you like to make a deposit?");
                    Console.WriteLine("Please select:\na. Checking Account\nb. Savings Account");
                    account = char.Parse(Console.ReadLine().ToLower());
                    if (account == 'a')
                    {
                        jsChecking.Deposit();
                    }
                    if (account == 'b')
                    {
                        jsSavings.Deposit();
                    }
                }
                if (selection == 4)
                {
                    Console.WriteLine("From which account would you like to make a withdrawal?");
                    Console.WriteLine("Please select:\na. Checking Account\nb. Savings Account");
                    account = char.Parse(Console.ReadLine().ToLower());
                    if (account == 'a')
                    {
                        jsChecking.Withdraw();
                    }
                    if (account == 'b')
                    {
                        jsSavings.Withdraw();
                    }
                }
            }while (selection != 5);
        }
示例#3
0
        static void Main(string[] args)
        {
            //instantiating our client and accounts.
            Client          oswaldCobblepot = new Client();
            CheckingAccount oswaldChecking  = new CheckingAccount();
            SavingsAccount  oswaldSavings   = new SavingsAccount();

            string firstChoice;
            string secondChoice;
            double deposit;
            double withdraw;

            do
            {
                // Welcome user and give them the menu to make their choices.
                Console.WriteLine("Welcome to Gotham National Bank.");
                Console.WriteLine("Please make a selection from the following menu.\n");
                Console.WriteLine("1. View Client Information\n2. View Account Balance\n3. Deposit Funds\n4. Withdraw Funds\n5. Exit\nPlease enter the number of your choice");
                firstChoice = Console.ReadLine();
                Console.Clear();

                //prints users info
                if (firstChoice == "1")
                {
                    oswaldCobblepot.Info();
                    Console.WriteLine("Press enter when done.");
                    Console.ReadLine();
                    Console.Clear();
                }

                //Shows balances of users accounts
                if (firstChoice == "2")
                {
                    do
                    {
                        Console.WriteLine("1. Checking Account Balance\n2. Savings Account Balance\n3. Back\n4. Exit");
                        secondChoice = Console.ReadLine();
                        Console.Clear();

                        if (secondChoice == "1")
                        {
                            Console.WriteLine("Your checking account balance is :");
                            oswaldChecking.GetBalance();
                        }

                        if (secondChoice == "2")
                        {
                            Console.WriteLine("Your savings account balance is :");
                            oswaldSavings.GetBalance();
                        }

                        if (secondChoice == "3")
                        {
                            break;
                        }

                        if (secondChoice == "4")
                        {
                            firstChoice = "5";
                            break;
                        }
                    } while (secondChoice != "1" || secondChoice != "2" || secondChoice != "3" || secondChoice != "4");
                }

                //allows user to deposit funds in their account.
                if (firstChoice == "3")
                {
                    do
                    {
                        Console.WriteLine("In which account would you like to make a deposit?\n1. Checking Account\n2. Savings Account\n3. Back\n4. Exit");
                        secondChoice = Console.ReadLine();
                        Console.Clear();

                        if (secondChoice == "1")
                        {
                            Console.WriteLine("How much would you like to deposit?");
                            deposit = double.Parse(Console.ReadLine());
                            oswaldChecking.Balance = oswaldChecking.Deposit(deposit);
                            Console.WriteLine("Your new balance is ");
                            oswaldChecking.GetBalance();
                            Console.WriteLine("Press enter to continue");
                            Console.ReadLine();
                            Console.Clear();
                        }

                        if (secondChoice == "2")
                        {
                            Console.WriteLine("How much would you like to deposit?");
                            deposit = double.Parse(Console.ReadLine());
                            oswaldSavings.Balance = oswaldSavings.Deposit(deposit);
                            Console.WriteLine("Your new balance is ");
                            oswaldSavings.GetBalance();
                            Console.WriteLine("Press enter to continue");
                            Console.ReadLine();
                            Console.Clear();
                        }

                        if (secondChoice == "3")
                        {
                            break;
                        }

                        if (secondChoice == "4")
                        {
                            firstChoice = "5";
                            break;
                        }
                    } while (secondChoice != "1" || secondChoice != "2" || secondChoice != "3" || secondChoice != "4");
                }

                //allows user to withdraw money from accounts
                if (firstChoice == "4")
                {
                    do
                    {
                        Console.WriteLine("In which account would you like to make a withdraw?\n1. Checking Account\n2. Savings Account\n3. Back\n4. Exit");
                        secondChoice = Console.ReadLine();
                        Console.Clear();

                        if (secondChoice == "1")
                        {
                            Console.WriteLine("How much would you like to withdraw?");
                            withdraw = double.Parse(Console.ReadLine());
                            oswaldChecking.Balance = oswaldChecking.Withdraw(withdraw);
                            Console.WriteLine("Your new balance is ");
                            oswaldChecking.GetBalance();
                            Console.WriteLine("Press enter to continue");
                            Console.ReadLine();
                            Console.Clear();
                        }

                        if (secondChoice == "2")
                        {
                            Console.WriteLine("How much would you like to withdraw?");
                            withdraw = double.Parse(Console.ReadLine());

                            //Checking to make sure savings account does not go below zero.
                            if (withdraw > oswaldSavings.Balance)
                            {
                                Console.WriteLine("Can not continue this transaction.\nInsuffient Funds.");
                                Console.WriteLine("Press enter to continue.");
                                Console.ReadLine();
                                Console.Clear();
                                break;
                            }
                            oswaldSavings.Balance = oswaldSavings.Withdraw(withdraw);
                            Console.WriteLine("Your new balance is ");
                            oswaldSavings.GetBalance();
                            Console.WriteLine("Press enter to continue");
                            Console.ReadLine();
                            Console.Clear();
                        }

                        if (secondChoice == "3")
                        {
                            break;
                        }

                        if (secondChoice == "4")
                        {
                            firstChoice = "5";
                            break;
                        }
                    } while (secondChoice != "1" || secondChoice != "2" || secondChoice != "3" || secondChoice != "4");
                }
            } while (firstChoice != "5");

            Console.WriteLine("Have a great day!");
        }