Beispiel #1
0
        static void Main()
        {
            List <Customer> customers = new List <Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);

            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);

            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);

            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);

            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);

            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);

            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
        static void Main()
        {
            List<Customer> customers = new List<Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);
            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);
            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);
            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);
            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);
            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);
            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
Beispiel #3
0
        static void Main()
        {
            List <Account> accaunt = new List <Account>()
            {
                new MortgageAccount(new Individual("Gosho"), 1200, 5),
                new MortgageAccount(new Company("CEZ"), 1500, 10),
                new LoanAccount(new Individual("Gosho"), 10000, 5),
                new LoanAccount(new Company("CEZ"), 12000, 12),
                new DepositAccount(new Individual("Gosho"), 20000, 2),
                new DepositAccount(new Company("CEZ"), 4000, 5),
            };

            foreach (var item in accaunt)
            {
                Console.WriteLine(item);
            }

            var acc = new MortgageAccount(new Individual("Gosho"), 1200, 5);

            Console.WriteLine(acc.CalculateInterestRate(18));
        }