Deposit() публичный Метод

public Deposit ( int deposit ) : void
deposit int
Результат void
Пример #1
1
        static void Main()
        {
            DepositAccount myDeposit = new DepositAccount(Customer.Individual, 0, 1);
            myDeposit.Deposit(2500);

            Console.WriteLine("Balance: {0}", myDeposit.Balance);
            Console.WriteLine("Interest: {0}", myDeposit.CalculateInterest(12));

            Console.WriteLine("... Withdrawing $2000 ...");
            myDeposit.Withdraw(-2000);
            // myDeposit.Withdraw(-2800); - this will throw exeption

            Console.WriteLine("New Balance {0}", myDeposit.Balance);
            Console.WriteLine("new Interest: {0}", myDeposit.CalculateInterest(12));
        }
Пример #2
0
        static void Main()
        {
            Customer IvanIvanov     = new IndividualCustomer("Ivan Ivanov");
            Customer PetarStoyanov  = new IndividualCustomer("Petar Stoyanov");
            Customer AnnaVasileva   = new IndividualCustomer("Anna Vasileva");
            Customer MariaAtanasova = new IndividualCustomer("Maria Atanasova ");
            Customer CocaCola       = new CompanyCustomer("CocaCola");
            Customer Microsoft      = new CompanyCustomer("Microsoft");
            Customer Apple          = new CompanyCustomer("Apple");
            Customer Google         = new CompanyCustomer("Google");

            DepositAccount depositIvanIvanov    = new DepositAccount(IvanIvanov, 800m, 0.05m);
            DepositAccount depositCocaCola      = new DepositAccount(CocaCola, 5000000m, 0.02m);
            LoanAccount    loanAnnaVasilev      = new LoanAccount(AnnaVasileva, -10000m, 0.12m);
            LoanAccount    loanGoogle           = new LoanAccount(Google, -1000000m, 0.08m);
            MortageAccount mortagePetarStoyanov = new MortageAccount(PetarStoyanov, -50000m, 0.07m);
            MortageAccount mortageMictosoft     = new MortageAccount(Microsoft, -5000000m, 0.06m);

            IList <Account> accounts = new List <Account>();

            accounts.Add(depositIvanIvanov);
            accounts.Add(depositCocaCola);
            accounts.Add(loanAnnaVasilev);
            accounts.Add(loanGoogle);
            accounts.Add(mortagePetarStoyanov);
            accounts.Add(mortageMictosoft);

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

            depositIvanIvanov.WithDraw(258.15m);
            Console.WriteLine("\nInterest for next 4 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine(account + " " + account.InterestAmount(4));
            }

            depositIvanIvanov.Deposit(800m);
            loanAnnaVasilev.Deposit(600.12m);
            mortagePetarStoyanov.Deposit(1825.12m);
            Console.WriteLine("\nInterest for next 8 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine(account + " " + account.InterestAmount(8));
            }

            Console.WriteLine("\nInterest for next 20 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine(account + " " + account.InterestAmount(20));
            }
        }
Пример #3
0
        static void Main()
        {
            DepositAccount myDeposit = new DepositAccount(Customer.Individual, 0, 1);

            myDeposit.Deposit(2500);

            Console.WriteLine("Balance: {0}", myDeposit.Balance);
            Console.WriteLine("Interest: {0}", myDeposit.CalculateInterest(12));

            Console.WriteLine("... Withdrawing $2000 ...");
            myDeposit.Withdraw(-2000);
            // myDeposit.Withdraw(-2800); - this will throw exeption

            Console.WriteLine("New Balance {0}", myDeposit.Balance);
            Console.WriteLine("new Interest: {0}", myDeposit.CalculateInterest(12));
        }
Пример #4
0
        public static void Main()
        {
            var client = new Individual("Client", "Sofia", 23);
            var account = new DepositAccount(client, 1000, 2);
            Console.WriteLine(account.Balance);
            //making a deposit of 100
            account.Deposit(100);
            //money after the deposit
            Console.WriteLine(account.Balance);
            //interest after 14months
            Console.WriteLine(account.CalculaterInterest(14));
            //making a withdraw
            account.Withdraw(500);
            Console.WriteLine(account.Balance);

            var account1 = new LoanAccount(new Company("ComapanySoft", "Varna", "1024443"), 10400, 7);
            //interest after 6months
            Console.WriteLine(account1.CalculaterInterest(6));
        }
Пример #5
0
        static void Main(string[] args)
        {
            //新建一个个人存款账户
            DepositAccount A = new DepositAccount("WHM", 0);

            //存款
            A.Deposit(20000);
            //取款
            A.Withdraw(5000);
            //获得利息
            Console.WriteLine("您的利息为:{0}。", A.GetInterest(18, 0.035));
            //新建一个企业贷款账户
            LoanAccount B = new LoanAccount("WH", 1);

            //存款
            B.Deposit(20000);
            //获得利息
            Console.WriteLine("您的利息为:{0}。", B.GetInterest(27, 0.037));
            //抵押贷款同理,此处不给出
        }
Пример #6
0
        public void TestDepositMethod()
        {
            Customer accountCustomer = new IndividualCustomer(
                "2343PJ34752",
                "William",
                "Harris",
                "1 Microsoft Way, Redmond, WA",
                "1-888-553-6562");

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

            account.Deposit(459M);

            Assert.AreEqual(32959M, account.Balance);
        }