コード例 #1
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)}");

        }
コード例 #2
0
ファイル: Program.cs プロジェクト: psdimitrov/homeworks
        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)));
        }
コード例 #3
0
ファイル: ProgramMain.cs プロジェクト: TaTRaTa/SoftUni
        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}");
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: elasharda1/Homeworks
        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);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: AlexanderDimitrov/OOP
        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}");
        }
コード例 #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()
        {
            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)}");
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        static void Main()
        {
            IndividualCustomer cst        = new IndividualCustomer("Ivo", "Pavlev", "Andonov", "083472221");
            DepositAccount     depositAcc = new DepositAccount(cst, 1000, 0.5m);

            Console.WriteLine(depositAcc);
            //  depositAcc.WithDraw(20);
            Console.WriteLine("New balance:{0}", depositAcc.Balance);
            // depositAcc.Deposit(100000);
            Console.WriteLine("New balance:{0}", depositAcc.Balance);
            Console.WriteLine("{0:0.0}", depositAcc.CalculateInterestAmount(12));
            //------------------------------------------------------------------------------
            Console.WriteLine();

            IndividualCustomer cst1    = new IndividualCustomer("Ivo", "Pavlev", "Andonov", "083472221");
            LoanAccount        loanAcc = new LoanAccount(cst1, 1000, 1m);

            Console.WriteLine(loanAcc);
            loanAcc.Deposit(50);
            //  depositAcc.WithDraw(20);
            // depositAcc.Deposit(100000);
            Console.WriteLine("New balance:{0}", loanAcc.Balance);
            Console.WriteLine("{0:0.0}", loanAcc.CalculateInterestAmount(5));
            //------------------------------------------------------------------------------
            Console.WriteLine();

            IndividualCustomer cst2       = new IndividualCustomer("Ivo", "Pavlev", "Andonov", "083472221");
            MortgageAccount    mortageAcc = new MortgageAccount(cst2, 1000, 1m);

            Console.WriteLine(mortageAcc);
            mortageAcc.Deposit(50);
            //  depositAcc.WithDraw(20);
            // depositAcc.Deposit(100000);
            Console.WriteLine("New balance:{0}", mortageAcc.Balance);
            Console.WriteLine("{0:0.0}", mortageAcc.CalculateInterestAmount(7));

            //------------------------------------------------------------------------------
            Console.WriteLine();
            CompanyCustomer cst3        = new CompanyCustomer("Masson", "083472221");
            MortgageAccount mortageAcc1 = new MortgageAccount(cst3, 10000, 1m);

            Console.WriteLine(mortageAcc1);
            mortageAcc1.Deposit(50);
            //  depositAcc.WithDraw(20);
            // depositAcc.Deposit(100000);
            Console.WriteLine("New balance:{0}", mortageAcc1.Balance);
            Console.WriteLine("{0:0.0}", mortageAcc1.CalculateInterestAmount(24));
        }
コード例 #10
0
ファイル: Start.cs プロジェクト: tdochev/TelerikAcademy
 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));
 }