示例#1
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Dimitar Dimitrov"),
                new IndividualCustomer("Petar Ivanov"),
                new CompanyCustomer("Glavbulgarstroy OOD"),
                new CompanyCustomer("Monbat AD"),
            };

            var depositAccount = new DepositAccount(clients[0], 18000m, 0.004);
            var loanAccount = new LoanAccount(clients[1], 500m, 0.015);
            var mortgageAccount = new MortgageAccount(clients[0], 5000m, 0.009);
            var depositAccount2 = new DepositAccount(clients[2], 100000m, 0.010);
            var depositAccount3 = new DepositAccount(clients[3], 1200, 0.08);

            depositAccount.Withdraw(1000m);
            depositAccount2.Withdraw(500m);
            mortgageAccount.Deposit(15m);
            loanAccount.Deposit(100m);

            try
            {
                depositAccount.Withdraw(100000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAccount2);
            Console.WriteLine(mortgageAccount);

            Console.WriteLine(loanAccount + string.Format(" Interest : {0:C}", loanAccount.CalculateInterest(12)));
        }
示例#2
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Pesho"),
                new IndividualCustomer("Gosho"),
                new CompanyCustomer("Soft Uni LTD"),
                new CompanyCustomer("Manchester United FC"),
            };

            var depositAcc = new DepositAccount(clients[0], 8955.33m, 0.005);
            var loanAcc = new LoanAccount(clients[1], 500m, 0.002);
            var mortgageAcc = new MortgageAccount(clients[2], 5m, 0.009);
            var depositAcc2 = new DepositAccount(clients[3], 159, 0.08);

            depositAcc.Withdraw(6000m);
            depositAcc2.Withdraw(54.22m);
            mortgageAcc.Deposit(15m);
            loanAcc.Deposit(5559.66m);

            try
            {
                depositAcc.Withdraw(500000000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAcc2);
            Console.WriteLine(mortgageAcc);

            Console.WriteLine(loanAcc + $" Interest rate: {loanAcc.CalculateIntereset(12):C}");
        }
示例#3
0
        static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Kiril"),
                new IndividualCustomer("Nakov"),
                new CompanyCustomer("SoftUni"),
            };

            DepositAccount kirilDepositAccount = new DepositAccount(clients[0],888.354m,55);
            MortgageAccount nakovMortgageAccount = new MortgageAccount(clients[1],3415.77m,12);
            LoanAccount softUniLoanAccount = new LoanAccount(clients[2],56756.789m,3);

            kirilDepositAccount.Withdraw(123.77m);
            nakovMortgageAccount.Deposit(124.55m);
            softUniLoanAccount.Deposit(1779.33m);

            // Try false input
            try
            {
                kirilDepositAccount.Withdraw(1000m);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(kirilDepositAccount);
            Console.WriteLine(nakovMortgageAccount);
            Console.WriteLine(softUniLoanAccount + $"\nInterest rate: {softUniLoanAccount.CalculateInterest(3)}");

        }
示例#4
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Pesho"),
                new IndividualCustomer("Gosho"),
                new CompanyCustomer("Soft Uni LTD"),
                new CompanyCustomer("Soft Uni Student Organisation"),
            };

            var depositAcc  = new DepositAccount(clients[0], 8955.33m, 0.005);
            var loanAcc     = new LoanAccount(clients[1], 1200m, 0.002);
            var mortgageAcc = new MortgageAccount(clients[2], 7005m, 0.009);
            var depositAcc2 = new DepositAccount(clients[3], 159, 0.08);

            depositAcc.Withdraw(6000m);
            depositAcc2.Withdraw(54.22m);
            mortgageAcc.Deposit(15m);
            loanAcc.Deposit(5559.66m);

            try
            {
                depositAcc.Withdraw(500000000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAcc2);
            Console.WriteLine(mortgageAcc);

            Console.WriteLine(loanAcc + $" Interest rate: {loanAcc.CalculateIntereset(12):C}");
        }
示例#5
0
        static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Kiril"),
                new IndividualCustomer("Nakov"),
                new CompanyCustomer("SoftUni"),
            };

            DepositAccount  kirilDepositAccount  = new DepositAccount(clients[0], 888.354m, 55);
            MortgageAccount nakovMortgageAccount = new MortgageAccount(clients[1], 3415.77m, 12);
            LoanAccount     softUniLoanAccount   = new LoanAccount(clients[2], 56756.789m, 3);

            kirilDepositAccount.Withdraw(123.77m);
            nakovMortgageAccount.Deposit(124.55m);
            softUniLoanAccount.Deposit(1779.33m);

            // Try false input
            try
            {
                kirilDepositAccount.Withdraw(1000m);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(kirilDepositAccount);
            Console.WriteLine(nakovMortgageAccount);
            Console.WriteLine(softUniLoanAccount + $"\nInterest rate: {softUniLoanAccount.CalculateInterest(3)}");
        }
示例#6
0
文件: MainProgram.cs 项目: T316/OOP
        static void Main()
        {
            DepositAccount depositAccount = new DepositAccount(new Customer("Pesho", "individual"), 1200m, 10m);
            DepositAccount companyDepositAccount = new DepositAccount(new Customer("Goshos", "company"), 160000m, 8m);
            LoanAccount loanAccount = new LoanAccount(new Customer("Gosho", "individual"), 8000m, 12m);
            MortgageAccount morgageAccount = new MortgageAccount(new Customer("Peshovi", "company"), 12000m, 16m);

            Console.WriteLine("Deposit balanse: " + depositAccount.Balance);
            depositAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + depositAccount.Balance);
            depositAccount.Withdraw(1200);
            Console.WriteLine("After withdraw 1200: " + depositAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Loan balanse: " + loanAccount.Balance);
            loanAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + loanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Morgage balanse: " + morgageAccount.Balance);
            morgageAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + morgageAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Diderent interest calculations: ");
            Console.WriteLine(depositAccount.CalculateInterest(5));
            Console.WriteLine(depositAccount.CalculateInterest(5));
            Console.WriteLine(loanAccount.CalculateInterest(3));
            Console.WriteLine(loanAccount.CalculateInterest(4));
            Console.WriteLine(morgageAccount.CalculateInterest(6));
            Console.WriteLine(morgageAccount.CalculateInterest(7));
            Console.WriteLine(companyDepositAccount.CalculateInterest(12));
            Console.WriteLine(companyDepositAccount.CalculateInterest(13));
        }
示例#7
0
    static void Main()
    {
        Customer examplePerson = new Customer("Example Person", CustomerType.Individual);
        Customer exampleCompany = new Customer("Example Company", CustomerType.Company);

        DepositAccount deposit = new DepositAccount(examplePerson, 1200, (decimal)0.02);
        int period = 2;
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period));

        deposit.Withdraw(300);
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period));

        deposit.Deposit(1000);
        Console.WriteLine("Test depositing money balance: {0}", deposit.Balance);

        period = 3;
        Loan loan = new Loan(examplePerson, 1200, (decimal)0.02);
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period));

        period = 4;
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period));

        loan.Deposit(1200);
        Console.WriteLine("After repaying the loan the balance is: {0}", loan.Balance);

        //invalid period test
        //Console.WriteLine(loan.CalcInterestAmount(-3));
    }
    private static void Main()
    {
        // Individual account test
        Costumer ivan = new Costumer("Ivan Ivanov", CostumerTypes.Individual);

        DepositAccount ivanDepositAccount = new DepositAccount(ivan, 1, 1000);

        int months = 5;

        decimal ivanInterest = ivanDepositAccount.CalculateInterest(months);

        Console.WriteLine(ivanDepositAccount.ToString() + "\n Interest for {0} months : {1}", months, ivanInterest + "\n");

        ivanDepositAccount.Withdraw(500);

        Console.WriteLine("After withdraw 500  \n" + ivanDepositAccount.ToString() + "\n");

        // Company Account test
        Costumer kokoOod = new Costumer("KOKO OOD", CostumerTypes.Company);

        LoanAccount kokoLoanAccount = new LoanAccount(kokoOod, 2, 50000);

        months = 12;

        decimal kokoInterest = kokoLoanAccount.CalculateInterest(months);
        Console.WriteLine(kokoLoanAccount.ToString() +
            "\n Interest for {0} months : {1}", months, kokoInterest + "\n");

        months = 13;
        kokoInterest = kokoLoanAccount.CalculateInterest(months);
        Console.WriteLine(kokoLoanAccount.ToString() +
            "\n Interest for {0} months : {1}", months, kokoInterest + "\n");
    }
示例#9
0
        public static void Main()
        {
            Bank bank = new Bank();

            Customer pesho  = new Customer("Pesho", CustomerType.Individual);
            Customer milko  = new Customer("Milko", CustomerType.Individual);
            Customer jichka = new Customer("jichka", CustomerType.Individual);

            Customer dell  = new Customer("Dell", CustomerType.Company);
            Customer hp    = new Customer("HP", CustomerType.Company);
            Customer apple = new Customer("Apple", CustomerType.Company);

            DepositAccount  peshoAccount  = new DepositAccount(pesho, 4300, 2.2m);
            LoanAccount     milkoAccount  = new LoanAccount(milko, 9999, 3.7m);
            MortgageAccount jichkaAccount = new MortgageAccount(jichka, 559, 1.2m);

            Account dellAccount  = new DepositAccount(dell, 17631782.4234m, 7.1m);
            Account hpAccount    = new LoanAccount(hp, 111111.1114m, 4.4m);
            Account appleAccount = new MortgageAccount(apple, 1888631782.4934234m, 11.1m);

            peshoAccount.Deposit(400.50m);
            peshoAccount.Withdraw(200);

            bank.AddAccount(peshoAccount);
            bank.AddAccount(milkoAccount);
            bank.AddAccount(jichkaAccount);
            bank.AddAccount(dellAccount);
            bank.AddAccount(hpAccount);
            bank.AddAccount(appleAccount);

            foreach (IAccount account in bank.Accounts)
            {
                Console.WriteLine($"{account} -- with interest for 23 months -> {account.CalculateInterest(23):F1}\n");
            }
        }
示例#10
0
        static void Main(string[] args)
        {
            Individual kiro = new Individual("Kiro");
            Individual ivan = new Individual("Ivan");
            Company    sap  = new Company("SAP");

            DepositAccount  kiroAccount = new DepositAccount(kiro, 1112, 0.2m);
            LoanAccount     ivanAccount = new LoanAccount(ivan, 2222, 0.29m);
            MortgageAccount sapAccount  = new MortgageAccount(sap, 3333, 0.23m);

            List <Account> accounts = new List <Account>()
            {
                kiroAccount,
                ivanAccount,
                sapAccount
            };

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }

            Console.WriteLine(kiroAccount.CalculateInterestrate(4));
            Console.WriteLine(sapAccount.CalculateInterestrate(55));
            sapAccount.Deposit(4141);
            kiroAccount.Withdraw(333);

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
        }
示例#11
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "2343PJ34752",
            "William",
            "Harris",
            "1 Microsoft Way, Redmond, WA",
            "1-888-553-6562");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2500,
            1.0825M,
            12);

        Customer loanAccountCustomer = new CorporateCustomer(
            "89BPQ123YJ0",
            "Oracle Corporation",
            "500 Oracle Parkway, Redwood Shores, Redwood City, California, United States",
            "1-981-717-9366");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            1000000000,
            1.0931M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "97A20LX3YJU",
            "Ginni",
            "Rometty",
            "Armonk, New York, U.S.",
            "1-129-342-3817");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            300000,
            1.0875M,
            36);

        decimal depositInterest = depositAccount.CalculateInterest(3);

        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);

        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);

        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
        public void WithdrawFromDepositAccount_CannotWithdrawNegativeAmount()
        {
            // Arrange
            Individual     personToWithdraw = new Individual();
            DepositAccount deposit          = new DepositAccount(personToWithdraw, 0.3);

            // Act and Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => deposit.Withdraw(-2));
        }
示例#13
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "2343PJ34752",
            "William",
            "Harris",
            "1 Microsoft Way, Redmond, WA",
            "1-888-553-6562");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2500,
            1.0825M,
            12);

        Customer loanAccountCustomer = new CorporateCustomer(
            "89BPQ123YJ0",
            "Oracle Corporation",
            "500 Oracle Parkway, Redwood Shores, Redwood City, California, United States",
            "1-981-717-9366");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            1000000000,
            1.0931M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "97A20LX3YJU",
            "Ginni",
            "Rometty",
            "Armonk, New York, U.S.",
            "1-129-342-3817");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            300000,
            1.0875M,
            36);

        decimal depositInterest = depositAccount.CalculateInterest(3);
        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);
        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);
        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
示例#14
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "123456789AA",
            "Pesho",
            "Peshov",
            "Sofia, Bulgaria, Tzarigradsko shose 2",
            "555-123-123");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2000,
            0.1234M,
            36);

        Customer loanAccountCustomer = new CorporateCustomer(
            "123456789AB",
            "Oracle Corporation",
            "Sofia, Bulgaria, Tzarigradsko shose 20",
            "555-123-321");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            9000000000,
            0.1234M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "223456789AA",
            "Ginni",
            "Rometty",
            "Sofia, Bulgaria, Tzarigradsko shose 22",
            "555-321-321");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            990000,
            0.1234M,
            12);

        decimal depositInterest = depositAccount.CalculateInterest(3);
        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);
        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);
        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
示例#15
0
        static void Main()
        {
            var customer = new IndividualCustomer("Pesho", "Sofia");
            var bankAccount = new DepositAccount(customer, 30.4);

            bankAccount.Deposit(2000M);
            Console.WriteLine("Current balance: {0}",bankAccount.Balance);
            Console.WriteLine("Interest amount: {0}", bankAccount.GetInterestAmount(23));

            bankAccount.Withdraw(160.50M);
            Console.WriteLine("Current balance: {0}",bankAccount.Balance);
        }
示例#16
0
        public static void Main()
        {
            List<IAccount> accounts = new List<IAccount>
            {
                new LoanAccount(new Company("Jurassic Pork"), 10000m, 9.4),
                new MortgageAccount(new Individual("Batman"), 0.01m, 4),
                new DepositAccount(new Individual("Bai Nakov"), 1000m, 2.6),
            };

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }

            DepositAccount floristGumpAccount = new DepositAccount(new Company("Florist Gump"), 17500m, 5.5);
            floristGumpAccount.Withdraw(2500);
            floristGumpAccount.Deposit(1000);
            Console.WriteLine(floristGumpAccount); // Should be 16000

            Console.WriteLine();

            Console.WriteLine(floristGumpAccount.Customer.Name + " -> " + floristGumpAccount.CalcInterest(4));

            floristGumpAccount.Withdraw(15500);
            //Console.WriteLine(floristGumpAccount.CalcInterest(8)); // Should throw exception

            IAccount papaRazziPizza = new LoanAccount(new Company("Papa Razzi"), 25000m, 9.4);
            Console.WriteLine(papaRazziPizza.Customer.Name + " -> " +papaRazziPizza.CalcInterest(2));

            IAccount baiSvetlin = new MortgageAccount(new Individual("Bai Nakov"), 1000m, 2.6);
            Console.WriteLine(baiSvetlin.Customer.Name + " -> " + baiSvetlin.CalcInterest(8));
            //Console.WriteLine(baiSvetlin.Customer.Name + " -> " + baiSvetlin.CalcInterest(4)); // Should throw exception

            IAccount dejaBrewAccount = new MortgageAccount(new Company("Deja Brew Brewery"), 8000, 2.6);
            Console.WriteLine(dejaBrewAccount.Customer.Name + " -> " + dejaBrewAccount.CalcInterest(1));
        }
示例#17
0
        static void Main()
        {
            var bajPesho = Customer.Individual;
            var leliaMarche = Customer.Individual;
            var mrAnderson = Customer.Individual;

            var google = Customer.Company;
            var microsoft = Customer.Company;
            var facebook = Customer.Company;

            var bajPeshoAccount = new DepositAccount(bajPesho, 200, 7);
            var leliaMarcheAccount = new MortgageAccount(leliaMarche, 200, 7);
            var mrAndersonAccount = new LoanAccount(mrAnderson, 200, 7);

            var googleAccount = new DepositAccount(google, 200, 7);
            var microsoftAccount = new MortgageAccount(microsoft, 200, 7);
            var facebookAccount = new LoanAccount(facebook, 200, 7);

            googleAccount.Withdraw(100);
               // Console.WriteLine(googleAccount.Balance);
            facebookAccount.Deposit(100);
               // Console.WriteLine(facebookAccount.Balance);

            var accounts = new List<IAccount>()
            {
                googleAccount,
                microsoftAccount,
                facebookAccount,
                bajPeshoAccount,
                leliaMarcheAccount,
                mrAndersonAccount
            };

            var sortedAccounts = accounts.OrderByDescending(account => account.Balance);

            foreach (var account in sortedAccounts)
            {
                decimal interestFirstMonths = account.CalculateInterest(3);
                decimal interest = account.CalculateInterest(13);

                Console.WriteLine("customer: {0} - balance: {1}; first months interest: {2}; interest: {3}"
                    , account.Customer, account.Balance, interestFirstMonths, interest);
            }
        }
示例#18
0
        public void TestWithdrawMethod()
        {
            Customer accountCustomer = new IndividualCustomer(
                "2343PJ34752",
                "William",
                "Harris",
                "1 Microsoft Way, Redmond, WA",
                "1-888-553-6562");

            DepositAccount account = new DepositAccount(
                accountCustomer,
                2500,
                1.0825M,
                12);

            account.Withdraw(400M);

            Assert.AreEqual(2100M, account.Balance);
        }
        static void Main()
        {
            string textSeparator = new string('-', 80);

            Console.WriteLine(textSeparator);

            DepositAccount IvanAccount = new DepositAccount(new Customer("Ivan Ivanov", CustomerType.Individual), 500M, 4.6M);

            IvanAccount.Deposit(1150);
            IvanAccount.Withdraw(250);
            var interstDeposit = IvanAccount.CalculateInterest(13);

            IvanAccount.Deposit(interstDeposit);

            Console.WriteLine("Current DepositAccount balance of customer: {0} is {1:c2} ",
                              IvanAccount.Customer.CustomerName, IvanAccount.Balance);

            Console.WriteLine(textSeparator);


            LoanAccount GeorgiAccount = new LoanAccount(new Customer("Georgi Petrov", CustomerType.Individual), 1000M, 4.6M);

            GeorgiAccount.Deposit(1500);
            var interstDepositOfGosho = GeorgiAccount.CalculateInterest(9);

            GeorgiAccount.Deposit(interstDeposit);

            Console.WriteLine("Current LoanAccount balance of customer: {0} is {1:c2} ",
                              GeorgiAccount.Customer.CustomerName, GeorgiAccount.Balance);
            Console.WriteLine(textSeparator);


            MortgageAccount companyAccount = new MortgageAccount(new Customer("Maznata Mucka LTD", CustomerType.Company), 1000M, 4.6M);

            companyAccount.Deposit(1500);
            var interstDepositOfCompany = companyAccount.CalculateInterest(11);

            companyAccount.Deposit(interstDeposit);

            Console.WriteLine("Current MortgageAccount balance of customer: {0} is {1:c2} ",
                              companyAccount.Customer.CustomerName, companyAccount.Balance);
            Console.WriteLine(textSeparator);
        }
    static void Main()
    {
        Console.WriteLine("----------Loan Account(Company)----------\n");
        LoanAccount accountOne = new LoanAccount(CustomerType.Company, 50000, 500, 24);
        accountOne.CalculateInterest();
        accountOne.Deposit(500);

        Console.WriteLine("\n\n----------Loan Account(Individual)----------\n");
        LoanAccount accountTwo = new LoanAccount(CustomerType.Individual, 50000, 500, 24);
        accountTwo.CalculateInterest();
        accountTwo.Deposit(500);

        Console.WriteLine("\n\n----------Mortage Account(Company)----------\n");
        MortageAccount accountThree = new MortageAccount(CustomerType.Company, 100000, 1000, 36);
        accountThree.CalculateInterest();
        accountThree.Deposit(10000);

        Console.WriteLine("\n\n----------Mortage Account(Individual)----------\n");
        MortageAccount accountFour = new MortageAccount(CustomerType.Individual, 100000, 1000, 36);
        accountFour.CalculateInterest();
        accountFour.Deposit(10000);

        Console.WriteLine("\n\n----------Deposit Account(Company)----------\n");
        DepositAccount accountFive = new DepositAccount(CustomerType.Company, 500000, 5000, 24);
        accountFive.CalculateInterest();
        accountFive.Deposit(100000);
        accountFive.Withdraw(200000);

        Console.WriteLine("\n\n----------Deposit Account(Individual)----------\n");
        DepositAccount accountSix = new DepositAccount(CustomerType.Individual, 500000, 5000, 24);
        accountSix.CalculateInterest();
        accountSix.Deposit(100000);
        accountSix.Withdraw(200000);

        Console.WriteLine("\n\n----------Deposit Account(Balance under 1000)----------\n");
        DepositAccount accountSeven = new DepositAccount(CustomerType.Individual, 500, 50, 6);
        accountSeven.CalculateInterest();
        accountSeven.Deposit(50);
        accountSeven.Withdraw(150);

        Console.WriteLine("\n\n\n");
    }
    static void Main(string[] args)
    {
        Customer facebook = new Customer("company");
        Customer Stephan  = new Customer("individual");

        DepositAccount deposit = new DepositAccount(facebook, 1100, 3);

        deposit.Withdraw(400);
        Console.WriteLine(deposit.Balance); // 1100 - 400 = 700
        deposit.Deposit(500);
        Console.WriteLine(deposit.Balance); // 700 + 500 = 1200

        LoanAccount loan = new LoanAccount(Stephan, 2000, 2);

        loan.Deposit(1000);
        Console.WriteLine(loan.Interest(12)); // 2000 * (1 + (2 * 12)/100)

        MortgageAccount mortgage = new MortgageAccount(facebook, 1000, 10);

        Console.WriteLine(mortgage.Interest(13));
    }
示例#22
0
    static void Main()
    {
        // Customers
        Customer[] customers = new Customer[4];
        customers[0] = new IndividualCustomer("Iliqn Petrov", 59784, "0894719648");
        customers[1] = new CompanieCustomer("Kiril Iliev", 81746, "0881446720");
        customers[2] = new IndividualCustomer("Nikolai Grancharov", 91002, "0874100359");
        customers[3] = new CompanieCustomer("Kiril Slavqnov", 00147, "0886979231");

        // Accounts
        DepositAccount firstDeposit = new DepositAccount(customers[0], 3000, 0.10m, 12);

        BankAccount[] accounts = new BankAccount[5];
        accounts[0] = firstDeposit;
        accounts[1] = new LoanAccount(customers[1], 5000, 0.08m, 6);
        accounts[2] = new LoanAccount(customers[2], 5000, 0.08m, 6);
        accounts[3] = new MortgageAccount(customers[2], 22900, 0.11m, 48);
        accounts[4] = new MortgageAccount(customers[3], 22900, 0.11m, 48);

        // Print 1
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("First Print ...");
        Console.ResetColor();
        foreach (var item in accounts)
        {
            Console.WriteLine(item);
            Console.WriteLine();
        }

        // Withdraw & Deposit
        firstDeposit.Withdraw(250);
        firstDeposit.Deposit(600);

        // Print 2
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("Second Print ...");
        Console.ResetColor();
        Console.WriteLine(accounts[0]);
        Console.ReadLine();
    }
示例#23
0
 public static void Main()
 {
     var testAcount = new DepositAccount(new Company("Abc", "040304123"), 3.47m);
     Console.WriteLine(testAcount);
     Console.WriteLine(testAcount.Deposit(1200m));
     Console.WriteLine(testAcount.Withdraw(101m));
     Console.WriteLine("Interest: " + testAcount.CalculateInterest(10));
     Console.WriteLine(testAcount);
     Console.WriteLine(new string('-', 60));
     var anotherTestAccount = new MortgageAccount(new Company("Apple", "040304123"), 5);
     Console.WriteLine(anotherTestAccount);
     Console.WriteLine(anotherTestAccount.Deposit(120m));
     Console.WriteLine("Interest:" + anotherTestAccount.CalculateInterest(13));
     Console.WriteLine(anotherTestAccount);
     Console.WriteLine(new string('-', 60));
     var yetAnotherTestAccount = new LoanAccount(new Individual("Gosho","8010271234"),4.2m);
     Console.WriteLine(yetAnotherTestAccount);
     Console.WriteLine(yetAnotherTestAccount.Deposit(180m));
     Console.WriteLine("Interest: " + yetAnotherTestAccount.CalculateInterest(3));
     Console.WriteLine(yetAnotherTestAccount);
     Console.WriteLine(new string('-', 60));
 }
示例#24
0
        public static void Main(string[] args)
        {
            var a1 = new DepositAccount("Kevin", "individual", 1000, 0.015);
            var a2 = new LoanAccount("Dep", "individual", 30000, 0.07);
            var a3 = new MortgageAccount("IVS LLC", "company", 80000, 0.04);
            var a4 = new MortgageAccount("John", "individual", 80000, 0.04);

            a1.DisplayAccountInfo();
            a2.DisplayAccountInfo();
            a3.DisplayAccountInfo();
            a4.DisplayAccountInfo();

            a1.InterestAfterMonths(12);
            a2.InterestAfterMonths(12);
            a3.InterestAfterMonths(12);
            a4.InterestAfterMonths(12);

            a1.Deposit(100);
            a2.Deposit(12);

            a1.Withdraw(100);
        }