Пример #1
0
        public static void Main(string[] args)
        {
            // initialise new private customer and all types of accounts with it
            var privateGosho      = new PrivateCustomer("Gosho", "Ubawetsa", "9005062452", "P0001620");
            var newDepositPrivate = new Deposit("DP00001", 1m, privateGosho);
            var newLoanPrivate    = new Loan("LP00001", 20m, privateGosho);
            var newMortPrivate    = new Mortgage("MP00001", 15m, privateGosho);

            // initialise ne corporate customer and all types of accounts with it
            var corporatePesho = new CorporateCustomer("Kurti ltd", "BG130607427", "C00012368");
            var newDepositCorp = new Deposit("DC00001", 0.5m, corporatePesho);
            var newLoanCorp    = new Loan("LC00001", 30m, corporatePesho);
            var newMortCorp    = new Mortgage("MC00001", 25, corporatePesho);

            // prit the corporate deposit account to ches the ToStrig() overriding
            Console.WriteLine(newDepositCorp);

            // deposit money to the corporatie deposit
            newDepositCorp.DepositMoney(2000m);

            // newDepositCorp.Withdraw(200m); // Shoud throw exeption (insufficient money)

            // prints the interest for 5 monts
            Console.WriteLine();
            Console.WriteLine(newDepositCorp.CalculateIntersetAmount(5));

            // deposit money to private loan
            newLoanPrivate.DepositMoney(100m);

            // print interest fow 2 monts for private loan
            Console.WriteLine();
            Console.WriteLine(newLoanPrivate.CalculateIntersetAmount(2));

            // and so on..
        }
Пример #2
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);
    }
Пример #3
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);
    }