Esempio n. 1
0
        static void Main(string[] args)
        {
            MattMurdock client1   = new MattMurdock();
            Checking    checking1 = new Checking();
            Saving      savings1  = new Saving();
            string      userChoice;
            string      secondChoice;
            string      thirdChoice;
            string      fourthChoice;

            //Greeting from the cleints bank
            do
            {
                Console.WriteLine("Welcome to the bank of Hell's Kitchen!");
                Console.WriteLine("How may I assist you today?");
                Console.WriteLine("1.View Client Information \n2.View Account Balance \n3.Deposit Funds \n4.Withdraw Funds \n5.Exit");
                userChoice = Console.ReadLine();
                Console.Clear();
                if (userChoice == "1")
                {
                    client1.ClientInfo();
                    Console.WriteLine("Press enter when finished");
                    Console.ReadLine();
                    Console.Clear();
                }
                if (userChoice == "2")
                {
                    do
                    {
                        Console.WriteLine("1. Checking \n2. Saving \n3. Back \n4. Exit");
                        secondChoice = Console.ReadLine();
                        Console.Clear();
                        if (secondChoice == "1")
                        {
                            checking1.CheckBalance();
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }
                        if (secondChoice == "2")
                        {
                            savings1.CheckBalance();
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }
                        if (secondChoice == "3")
                        {
                            break;
                        }
                        if (secondChoice == "4")
                        {
                            userChoice = "5";
                            break;
                        }
                    } while (secondChoice != "1" || secondChoice != "2" || secondChoice != "3" || secondChoice != "4");
                }
                if (userChoice == "3")
                {
                    do
                    {
                        Console.WriteLine("For which account would you like to make a deposit too?");
                        Console.WriteLine("1. Checking \n2. Saving \n3. Back \n4. Exit");
                        thirdChoice = Console.ReadLine();
                        Console.Clear();
                        if (thirdChoice == "1")
                        {
                            Console.WriteLine("How much would you like to deposit into your Checking Account?");
                            double deposit = Convert.ToDouble(Console.ReadLine());
                            checking1.Deposit(deposit);
                            Console.WriteLine("Current Balance: $" + checking1.AccountBalance);
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }
                        if (thirdChoice == "2")
                        {
                            Console.WriteLine("How much would you like to deposit into your Savings Account?");
                            double deposit = Convert.ToDouble(Console.ReadLine());
                            savings1.Deposit(deposit);
                            Console.WriteLine("Current Balance: $" + savings1.AccountBalance);
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }
                        if (thirdChoice == "3")
                        {
                            break;
                        }
                        if (thirdChoice == "4")
                        {
                            userChoice = "5";
                            break;
                        }
                    } while (thirdChoice != "1" || thirdChoice != "2" || thirdChoice != "3" || thirdChoice != "4");
                }
                if (userChoice == "4")
                {
                    do
                    {
                        Console.WriteLine("For which account would you like to make withdraw from?");
                        Console.WriteLine("1. Checking \n2. Saving\n3. Back \n4. Exit");
                        fourthChoice = Console.ReadLine();
                        Console.Clear();

                        if (fourthChoice == "1")
                        {
                            Console.WriteLine("How much would you like to withdraw from your Checking Account?");
                            double withdraw = Convert.ToDouble(Console.ReadLine());
                            checking1.Withdraw(withdraw);
                            Console.WriteLine("Current Balance: $" + checking1.AccountBalance);
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }

                        if (fourthChoice == "2")
                        {
                            Console.WriteLine("How much would you like to withdraw from your Savings Account?");
                            double withdraw = Convert.ToDouble(Console.ReadLine());

                            if (withdraw > savings1.AccountBalance)
                            {
                                Console.WriteLine("I'm sorry, but you do not have sufficient funds for that transaction!");
                                Console.WriteLine("Press enter when finished");
                                Console.ReadLine();
                                Console.Clear();
                                break;
                            }

                            savings1.Withdraw(withdraw);
                            Console.WriteLine("Current Balance: $" + savings1.AccountBalance);
                            Console.WriteLine("Press enter when finished");
                            Console.ReadLine();
                            Console.Clear();
                        }


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

            Console.WriteLine("We appreciate your business here at The Bank of Hell's Kitchen");
            Console.WriteLine("Have a great day and watch out for that DareDevil guy!");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Client   mainClient = new Client();
            Checking checking1  = new Checking();
            Saving   saving1    = new Saving();

            double amount;
            int    menuChoice = 0;
            int    moreChoice = 0;

            while (menuChoice < 1 || menuChoice > 5)
            {
                while (menuChoice != 5)
                {
                    Console.WriteLine("Welcome to SHAM WOW Bank.");
                    Console.WriteLine("How can we you help today?");
                    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");


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

                    if (menuChoice == 1)
                    {
                        mainClient.ViewInfo();  // <-- printing out clients information
                        break;
                    }


                    else if (menuChoice == 2)
                    {
                        while (moreChoice < 1 || moreChoice > 2)
                        {
                            Console.WriteLine("Which account would you like to access?");
                            Console.WriteLine("1.Checking Account");
                            Console.WriteLine("2.Saving Account");
                            moreChoice = int.Parse(Console.ReadLine());
                        }

                        if (moreChoice == 1)
                        {
                            checking1.ViewInfo();
                            break;
                        }

                        else if (moreChoice == 2)
                        {
                            saving1.ViewInfo();
                            break;
                        }
                    }
                    else if (menuChoice == 3)
                    {
                        Console.WriteLine("How much would you like to deposit?");
                        amount = double.Parse(Console.ReadLine());

                        while (moreChoice < 1 || moreChoice > 2)
                        {
                            Console.WriteLine("Where would you like to deposit?");
                            Console.WriteLine("1.Checking Account");
                            Console.WriteLine("2.Saving Account");
                            moreChoice = int.Parse(Console.ReadLine());

                            if (moreChoice == 1)
                            {
                                checking1.Deposit(amount);
                                checking1.ViewInfo();
                                break;
                            }
                            else if (moreChoice == 2)
                            {
                                saving1.Deposit(amount);
                                saving1.ViewInfo();
                                break;
                            }
                        }
                    }
                    else if (menuChoice == 4)
                    {
                        Console.WriteLine("How much would you like to withdraw?");
                        amount = double.Parse(Console.ReadLine());

                        while (moreChoice < 1 || moreChoice > 2)
                        {
                            Console.WriteLine("Where would you like to withdraw?");
                            Console.WriteLine("1.Checking Account");
                            Console.WriteLine("2.Saving Account");
                            moreChoice = int.Parse(Console.ReadLine());


                            if (moreChoice == 1)
                            {
                                checking1.Withdraw(amount);
                                checking1.ViewInfo();
                                break;
                            }
                            else if (moreChoice == 2)
                            {
                                // saving1.InsufficientFunds(); <-- could not understand how to incorperate a min value without funds to go under
                                saving1.Withdraw(amount);
                                saving1.ViewInfo();
                                break;
                            }
                        }
                    }
                    else if (menuChoice == 5)
                    {
                        Console.WriteLine("Thank you for banking with SHAM WOW.");

                        Environment.Exit(0);
                        return;
                    }

                    else
                    {
                        Console.WriteLine("Invalid. \nPlease pick another option");
                    }
                }
            }
        }