Example #1
0
        public void CustomerBalanceEnquiry(Customer name)
        {
            Console.WriteLine("\n Current balance" );
            Console.WriteLine("\n\tAccount\t\t\tBalance");
            Console.WriteLine("\t-------\t\t\t-------");

            Console.WriteLine("\tCheckings\t\t$" + name.GetCheckingsAccount().GetAccountBalance());
            Console.WriteLine("\tSavings\t\t\t$" + name.GetSavingsAccount().GetAccountBalance());
        }
Example #2
0
        public void CustomerDeposit(Customer name)
        {
            // Get the destination account
            Console.Write("\n Select account (1 - to Checkings Account, 2 - to Savings Account): ");
            var selection = Convert.ToInt32(Console.ReadLine());
            var destinationAccount = selection == 1 ? (Account) name.GetCheckingsAccount() : (Account) name.GetSavingsAccount();

            // Get the deposit amount
            Console.Write("\n Enter Amount: ");
            var depositAmount = Convert.ToDouble((Console.ReadLine()));

            // Create a new transaction with the deposit info
            Transaction depositTransaction = new DepositTransaction(destinationAccount, depositAmount);

            // Deposit the money into the account
            depositTransaction.FinalizeTransaction();
            Console.WriteLine("\n\tDeposit Completed");
        }
Example #3
0
        public void CustomerActivityEnquiry(Customer name)
        {
            Console.WriteLine("\n Checkings Account");
            Console.WriteLine("\n\tAccount\t\tDate\t\tActivity");
            Console.WriteLine("\t-------\t\t----\t\t--------");

            foreach (var transaction in name.GetCheckingsAccount().GetAccountActivity())
            {
                Console.WriteLine("\t$" + transaction.GetAmount() + "\t\t" + transaction.GetDate().ToString("MM/dd/yyyy") + "\t" + transaction.GetDescription());
            }

            Console.WriteLine("\n\n Savings Account");
            Console.WriteLine("\n\tAccount\t\tDate\t\tActivity");
            Console.WriteLine("\t-------\t\t----\t\t--------");

            foreach (var transaction in name.GetSavingsAccount().GetAccountActivity())
            {
                Console.WriteLine("\t$" + transaction.GetAmount() + "\t\t" + transaction.GetDate().ToString("MM/dd/yyyy") + "\t" + transaction.GetDescription());
            }
        }
Example #4
0
        public void CustomerTransfer(Customer name)
        {
            // Get the account to transfer between
            Console.Write("\n Select account (1 - Checkings to Savings, 2 - Savings to Checkings): ");
            var selection = Convert.ToInt32(Console.ReadLine());

            Account sourceAccount;
            Account destinationAccount;

            switch (selection)
            {
                case 1:
                    sourceAccount = name.GetCheckingsAccount();
                    destinationAccount = name.GetSavingsAccount();
                    break;
                default:
                    sourceAccount = name.GetSavingsAccount();
                    destinationAccount = name.GetCheckingsAccount();
                    break;
            }

            // Get the transfer amount
            Console.Write("\n Enter Amount: ");
            var transferAmount = Convert.ToDouble((Console.ReadLine()));

            // Create a new transaction with the transfer info
            var transferTransaction = new TransferTransaction(sourceAccount, destinationAccount, transferAmount).FinalizeTransaction();

            if (transferTransaction == TransactionResult.Success)
            {
                Console.WriteLine("\n\tTransfer Completed");
            }
            else
            {
                Console.WriteLine("\n\tInsufficient funds, account balance $" + sourceAccount.GetAccountBalance());
            }
        }
Example #5
0
        public void Run()
        {
            Console.WriteLine("Welcome to the Algonquin Banking System!");
            Console.Write("\nEnter Customer Name: ");

            // Intantiate a new customer object with the customers name
            var customer = new Customer(Console.ReadLine());

            var menuSelection = 0;

            do
            {
                // Display Option Menu
                DisplayMenu();

                // Get the user's menu selection
                menuSelection = Convert.ToInt32(Console.ReadLine());

                switch (menuSelection)
                {
                    case 1:
                        // Customer wants to make a deposit
                        CustomerDeposit(customer);
                        break;
                    case 2:
                        // Customer wants to make a withdrawl
                        CustomerWithdraw(customer);
                        break;
                    case 3:
                        // Customer wants to transfer funds
                        CustomerTransfer(customer);
                        break;
                    case 4:
                        // Customer wants to check account activity
                        CustomerActivityEnquiry(customer);
                        break;
                    case 5:
                        // Customer wants to check account balance
                        CustomerBalanceEnquiry(customer);
                        break;
                    case 6:
                        Console.WriteLine("\n Thank you for using the Algonquin College Banking System!");
                        break;
                    default:
                        // Invalid, please try again
                        Console.WriteLine("Invalid selection! Enter 1 to 6 online!");
                        break;
                }
            } while (menuSelection != 6);

            Console.ReadKey();
        }
Example #6
0
        public void CustomerWithdraw(Customer name)
        {
            // Get the source account
            Console.Write("\n Select account (1 - from Checkings Account, 2 - from Savings Account): ");
            var selection = Convert.ToInt32(Console.ReadLine());
            var sourceAccount = selection == 1 ? (Account)name.GetCheckingsAccount() : (Account)name.GetSavingsAccount();

            // Get the withdraw amount
            Console.Write("\n Enter Amount: ");
            var withdrawAmount = Convert.ToDouble((Console.ReadLine()));

            // Create a new transaction with the withdraw info
            var withdrawTransaction = new WithdrawTransaction(sourceAccount, withdrawAmount).FinalizeTransaction();

            if (withdrawTransaction == TransactionResult.Success)
            {
                Console.WriteLine("\n\tWithdrawl Completed");
            }
            else
            {
                Console.WriteLine("\n\tInsufficient funds, account balance $" + sourceAccount.GetAccountBalance());
            }
        }