Bolshakova Anna 5fe0c62010 first commit | 8 mesiacov pred | |
---|---|---|
.idea | 8 mesiacov pred | |
t6_oop1 | 8 mesiacov pred | |
README.md | 8 mesiacov pred | |
t6_oop1.sln | 8 mesiacov pred |
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}");
}
}
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();
}
}
}
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);
}
}
Вывод:
Малыш проводит экскурсию в:
Йолка - $3999
бульвар - $598