Загрузка данных


using System;

class Computer
{
    public int Frequency { get; set; }
    public int Cores { get; set; }
    public int Memory { get; set; }
    public int HardDisk { get; set; }

    public Computer(int frequency, int cores, int memory, int hardDisk)
    {
        Frequency = frequency;
        Cores = cores;
        Memory = memory;
        HardDisk = hardDisk;
    }

    public virtual double Cost()
    {
        return Frequency * Cores / 100.0
             + Memory / 80.0
             + HardDisk / 20.0;
    }

    public virtual bool Suitable()
    {
        return Frequency >= 2000 &&
               Cores >= 2 &&
               Memory >= 2048 &&
               HardDisk >= 320;
    }

    public virtual string Information()
    {
        return $"Частота процессора: {Frequency} МГц\n" +
               $"Количество ядер: {Cores}\n" +
               $"Объём памяти: {Memory} МБ\n" +
               $"Объём жёсткого диска: {HardDisk} ГБ\n" +
               $"Стоимость: {Cost():F2}\n" +
               $"Пригодность: {(Suitable() ? "Да" : "Нет")}\n";
    }
}

class Laptop : Computer
{
    public int BatteryLife { get; set; }

    public Laptop(int frequency, int cores, int memory,
                  int hardDisk, int batteryLife)
        : base(frequency, cores, memory, hardDisk)
    {
        BatteryLife = batteryLife;
    }

    public override double Cost()
    {
        return base.Cost() + BatteryLife / 10.0;
    }

    public override bool Suitable()
    {
        return base.Suitable() && BatteryLife >= 60;
    }

    public override string Information()
    {
        return base.Information() +
               $"Время автономной работы: {BatteryLife} минут\n";
    }
}

class Program
{
    static void Main()
    {
        Computer computer =
            new Computer(2500, 4, 8192, 512);

        Laptop laptop =
            new Laptop(2200, 4, 4096, 512, 120);

        Console.WriteLine("Обычный компьютер:");
        Console.WriteLine(computer.Information());

        Console.WriteLine("Ноутбук:");
        Console.WriteLine(laptop.Information());
    }
}