123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System.Reflection;
- class Category
- {
- public string title { get; set; }
- public Category(string Title)
- {
- title = Title;
- }
- public void Display()
- {
- Console.WriteLine($"Это путешествие {title}");
- }
- }
- class Place
- {
- public string Name { get; set; }
- public int Price { get; set; }
- public Category category { get; set; }
- public Place(string name, int price)
- {
- Name = name;
- Price = price;
- }
- public void Display()
- {
- Console.WriteLine($"{Name} - ${Price}");
- }
- }
- class Client
- {
- public string Name { get; set; }
- public Client (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("Крым", 50000);
- Place place2 = new Place("Сочи", 36000);
- Place place3 = new Place("Самара", 25000);
- Place place4 = new Place("Санкт-Петербург", 20000);
- Place place5 = new Place("Мальдивы", 140000);
- Client client1 = new Client("Маша");
- Client client2 = new Client("Паша");
- Client client3 = new Client("Леша");
- Client client4 = new Client("Катя");
- Category category1 = new ("по России" );
- Category category2 = new ("за границей" );
- List<Place> places = new List<Place> { place2 };
- client3.Order(places);
- category1.Display();
- }
- }
|