WithdrawMoney() public method

public WithdrawMoney ( decimal money ) : void
money decimal
return void
Example #1
0
        static void Main()
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(new string('=', 42));

            // Create an instances of the new accounts
            DepositAccount  depositAcc  = new DepositAccount(CustomerType.Individual, "Gaius Julius Caesar", 3750, 5);
            LoanAccount     loanAccInd  = new LoanAccount(CustomerType.Individual, "King Leonidas", 5700, 4);
            LoanAccount     loanAccComp = new LoanAccount(CustomerType.Company, "Naglite Corp.", 67879, 3);
            MortgageAccount mortgageAcc = new MortgageAccount(CustomerType.Company, "Talasumi Ltd.", 3700, 4);

            // Testing of the Deposit Account, Custumer Type - Individual
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Customer Name: {0}\nCustomer Type: {1}", depositAcc.Customer, depositAcc.CustomerType);
            Console.WriteLine("Deposit balance is: {0}", depositAcc.Balance);
            depositAcc.DepositMoney(3000);
            Console.WriteLine("After depositing of 3000 the balance is: {0}", depositAcc.Balance);

            Console.WriteLine("Deposit balance is: {0}", depositAcc.Balance);
            depositAcc.WithdrawMoney(1000);
            Console.WriteLine("After withdrawing 1000 the balance is: {0}", depositAcc.Balance);

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(new string('=', 42));

            // Testing of the Loan Account, Custumer Type - Individual
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("Customer Name: {0}\nCustomer Type: {1}", loanAccInd.Customer, loanAccInd.CustomerType);
            Console.WriteLine("Deposit balance is: {0}", loanAccInd.Balance);
            loanAccInd.DepositMoney(1000);
            Console.WriteLine("After deposition of 1000 balance is: {0}", loanAccInd.Balance);

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(new string('=', 42));

            // Testing of the Loan Account, Custumer Type - Company
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Customer Name: {0}\nCustomer Type: {1}", loanAccComp.Customer, loanAccComp.CustomerType);
            Console.WriteLine("Deposit balance is: {0}", loanAccComp.Balance);
            loanAccComp.DepositMoney(7500);
            Console.WriteLine("After deposition of 7500 balance is: {0}", loanAccComp.Balance);

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(new string('=', 42));

            // Testing the Interest Amount
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Interest Ammount of the accounts for 18 months: \n{0}: {1} \n{2}: {3} \n{4}: {5}",
                              depositAcc.Customer, depositAcc.InterestAmount(18), loanAccInd.Customer, loanAccInd.InterestAmount(18),
                              loanAccComp.Customer, loanAccComp.InterestAmount(18), mortgageAcc.Customer, mortgageAcc.InterestAmount(18));

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(new string('=', 42));
        }