Class1.cs 964 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace ClassLibrary1;
  2. using System.Reflection;
  3. public class Category
  4. {
  5. public string title { get; set; }
  6. public Category(string Title)
  7. {
  8. title = Title;
  9. }
  10. public void Display()
  11. {
  12. Console.WriteLine($"Это путешествие {title}");
  13. }
  14. }
  15. public class Place
  16. {
  17. public string Name { get; set; }
  18. public int Price { get; set; }
  19. public Category category { get; set; }
  20. public Place(string name, int price)
  21. {
  22. Name = name;
  23. Price = price;
  24. }
  25. public void Display()
  26. {
  27. Console.WriteLine($"{Name} - ${Price}");
  28. }
  29. }
  30. public class Client
  31. {
  32. public string Name { get; set; }
  33. public Client (string name)
  34. {
  35. Name=name;
  36. }
  37. public void Order(List<Place> places)
  38. {
  39. Console.WriteLine($"{Name} выбрал путешествие в: ");
  40. foreach (var place in places)
  41. {
  42. place.Display();
  43. }
  44. }
  45. }