Program.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System.Reflection;
  2. class Category
  3. {
  4. public string title { get; set; }
  5. public Category(string Title)
  6. {
  7. title = Title;
  8. }
  9. public void Display()
  10. {
  11. Console.WriteLine($"Это путешествие {title}");
  12. }
  13. }
  14. class Place
  15. {
  16. public string Name { get; set; }
  17. public int Price { get; set; }
  18. public Category category { get; set; }
  19. public Place(string name, int price)
  20. {
  21. Name = name;
  22. Price = price;
  23. }
  24. public void Display()
  25. {
  26. Console.WriteLine($"{Name} - ${Price}");
  27. }
  28. }
  29. class Client
  30. {
  31. public string Name { get; set; }
  32. public Client (string name)
  33. {
  34. Name=name;
  35. }
  36. public void Order(List<Place> places)
  37. {
  38. Console.WriteLine($"{Name} выбрал путешествие в: ");
  39. foreach (var place in places)
  40. {
  41. place.Display();
  42. }
  43. }
  44. }
  45. class Program
  46. {
  47. static void Main(string[] args)
  48. {
  49. Place place1 = new Place("Крым", 50000);
  50. Place place2 = new Place("Сочи", 36000);
  51. Place place3 = new Place("Самара", 25000);
  52. Place place4 = new Place("Санкт-Петербург", 20000);
  53. Place place5 = new Place("Мальдивы", 140000);
  54. Client client1 = new Client("Маша");
  55. Client client2 = new Client("Паша");
  56. Client client3 = new Client("Леша");
  57. Client client4 = new Client("Катя");
  58. Category category1 = new ("по России" );
  59. Category category2 = new ("за границей" );
  60. List<Place> places = new List<Place> { place2 };
  61. client3.Order(places);
  62. category1.Display();
  63. }
  64. }