﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _02___Bank_accounts
{
    public class Deposit : Account
    {
        private Individual individual;
        private int p1;
        private int p2;

        //Deposit accounts are allowed to deposit and with draw money.
        public void WithDraw(decimal amout)
        {
            if (amout > this.Balance)
            {
                throw new ArgumentException("You dont have enough money for this transaction!");
            }
            this.Balance -= amout;
        }

        public override decimal Interest(int numberOfMonths)
        {
            //Deposit accounts have no interest if their balance is positive and less than 1000.
            if (this.Balance > 0 && this.Balance < 1000)
            {
                return 0m;
            }
            else
            {
                return base.InterestRate * numberOfMonths;

            }
        }
        public Deposit(Customer customer, decimal balance, decimal interestRate)
            : base(customer, balance, interestRate)
        {
        }
    }
}
