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

namespace island
{
    public class Animal
    {
        public long Count;// количество животных данного вида
        double kDead;// естественная убыль
        double kBorn;// рождаемость
        double kEatMeal;// аппетит сколько ест одно животное
        /// <summary>
        /// Это конструктор класса !
        /// </summary>
        /// <param name="c"></param>
        /// <param name="kDead"></param>
        /// <param name="kBorn"></param>
        /// <param name="kEatMeal"></param>
        public Animal(int c, double kDead, double kBorn, double kEatMeal)
        {
            Count = c;            
            this.kDead = kDead;
            this.kBorn = kBorn;
            this.kEatMeal = kEatMeal;
        }
        public void Born()
        {
            Count += Convert.ToInt32(Count * kBorn);
        }
        public void Dead()
        {            
            Count -= Convert.ToInt32(Count * kDead);
            if (Count <= 0) Count = 0;    
        }
        public long Eat(long Food)
        {
            int CanEat = Convert.ToInt32(Count * kEatMeal);
            if (Food >= CanEat)
            {
                Food -= CanEat;
            }
            else
            {
                Count = Convert.ToInt32(Food / kEatMeal);
                Food = 0;
            }
            return Food;
        }
        public override String ToString()
        {
            String str="";
            str = "Animal count: " + Count.ToString() +
                  "kD: " + kDead.ToString() +
                  "kB: " + kBorn.ToString() +
                  "kE: " + kEatMeal.ToString();
            return str;
        }
    }
}
