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

namespace Task2
{
    class Worker:Human
    {
        public Worker(string first, string last, decimal salary, float hours)
            : base(first, last)
        {
            this.salary = salary;
            this.workHoursPerDay = hours;
        }

        private decimal salary;

        public decimal Salary
        {
            get { return salary; }
            set
            {
                if (value >= 0)
                {
                    salary = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Cant have negative salary.");
                }

            }
        }
        private float workHoursPerDay;

        public float WorkHoursPerDay
        {
            get { return workHoursPerDay; }
            set
            {
                if (value >= 0)
                {
                    workHoursPerDay = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Cant have negative salary.");
                }
            }
        }
        public decimal MonyPerHour
        {
            get { return (salary / (decimal)(5 * workHoursPerDay)); }
        }
        public override string ToString()
        {
            return FirstName + " " + LastName + " " + workHoursPerDay + " " +salary+" " +MonyPerHour;
        }

    }
}
