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

namespace Tutorial_9
{
    public abstract class Car
    {
        protected abstract decimal Price { get; }
        public decimal PriceAfterDays(decimal numDays)
        {
            decimal result;
            if (numDays < 0 || numDays >= 90) throw new ArgumentOutOfRangeException("Provided number of days is invalid");
            if (numDays < 5)
            {
                result = Price * numDays;
            }
            else if (numDays < 10)
            {
                result = Price * numDays * 0.9M;
            }
            else if (numDays < 20)
            {
                result = Price * numDays * 0.85M;
            }
            else
            {
                result = Price * numDays * 0.8M;
            }
            return result;
        }
    }

    public class Hatchback : Car
    {
        protected override decimal Price => 50;
    }

    public class Sedan : Car
    {
        protected override decimal Price => 80;
    }

    public class Convertible : Car
    {
        protected override decimal Price => 100;
    }

    public class Saloon : Car
    {
        protected override decimal Price => 120;
    }
    public class Motorcycle : Car
    {
        protected override decimal Price => 20;
    }
}
