No Description

abolshakova 7764fd7b1f Обновить 'README.md' 9 months ago
.idea 7f3eea6610 first commit 9 months ago
ClassLibrary1 7f3eea6610 first commit 9 months ago
t7_dll 7f3eea6610 first commit 9 months ago
README.md 7764fd7b1f Обновить 'README.md' 9 months ago
t7_dll.sln 7f3eea6610 first commit 9 months ago

README.md

Program.cs

using ClassLibrary1;
using System;

class Program
{
    static void Main(string[] args)
    {
        Place place1 = new Place("Йолка", 3999);
        Place place2 = new Place("набережная", 199);
        Place place3 = new Place("бульвар", 598);
        Place place4 = new Place("шарага", 10);
        Place place5 = new Place("КБ", 9999);

        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();
        }
    }
}


Вывод

Малыш проводит экскурсию в: 
Йолка - $3999 
бульвар - $598