Чернов Данил И-21

dpokatski 33b911b0bd lab14 há 8 meses atrás
lab01 9debbe9ebd lab12 há 10 meses atrás
lab02 9debbe9ebd lab12 há 10 meses atrás
lab03 9debbe9ebd lab12 há 10 meses atrás
lab04 9debbe9ebd lab12 há 10 meses atrás
lab05 9debbe9ebd lab12 há 10 meses atrás
lab06 9debbe9ebd lab12 há 10 meses atrás
lab07 9debbe9ebd lab12 há 10 meses atrás
lab08 9debbe9ebd lab12 há 10 meses atrás
lab09 9debbe9ebd lab12 há 10 meses atrás
lab10 b8046db1ec lab10 há 10 meses atrás
lab11 9c1751a445 lab11 há 10 meses atrás
lab12 9debbe9ebd lab12 há 10 meses atrás
lab13 281b167fe1 lab13 há 8 meses atrás
lab14 33b911b0bd lab14 há 8 meses atrás
readme.md 33b911b0bd lab14 há 8 meses atrás

readme.md

Lab 14. Библиотеки классов

Тема "Гостиничный бизнес"

Program.cs

using ClassLibrary1;
using System;

class Program
{
    static void Main(string[] args)
    {
        Place place1 = new Place("Дешевый номер", 999);
        Place place2 = new Place("Обычный номер", 5000);
        Place place3 = new Place("Дорогой номер", 20000);
        Place place4 = new Place("Номер люкс", 100000);
        Place place5 = new Place("Апартаменты", 500000);

        Workers worker1 = new Workers("Максим");
        Workers worker2 = new Workers("Дмитрий");
        Workers worker3 = new Workers("Милана");
        Workers worker4 = new Workers("Георгий");

        List<Place> places = new List<Place> { place1, place3 };

        worker1.Order(places);
    }
}

Peron.cs

namespace ClassLibrary1;
 
public class Place
{
    public string Name { get; set; }
    public int Price { get; set; }

    public Place(string name, int price)
    {
        Name = name;
        Price = price;
    }

    public void Display()
    {
        Console.WriteLine($"{Name} - ${Price}");
    }
}

public class Workers
{
    public string Name { get; set; }

    public Workers(string name)
    {
        Name = name;
    }

    public void Order(List<Place> places)
    {
        Console.WriteLine($"{Name} обслуживает: ");
        foreach (var place in places)
        {
            place.Display();
        }
    }
}
Вывод
Максим обслуживает: 
Дешевый номер - $999 
Дорогой номер - $20000