Advertisement
gandalfbialy

Untitled

May 30th, 2025
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using Cinema;
  2.  
  3. // Class responsible for storing and managing cinema showtimes.
  4. public class ShowCatalog
  5. {
  6. // Private list of all showtimes.
  7. private readonly List<Show> _shows = new();
  8.  
  9. // Exposes the showtimes as a read-only collection.
  10. public IReadOnlyList<Show> Shows => _shows;
  11.  
  12. // Adds sample showtimes to the catalog.
  13. public void SeedSampleShows()
  14. {
  15. // Add the "Matrix" showtime.
  16. Add(new Show(
  17. title: "Matrix",
  18. showDate: new DateTime(2025, 4, 10),
  19. showHour: new DateTime(2025, 4, 10, 18, 0, 0),
  20. numberOfSeats: 30));
  21.  
  22. // Add the "Inception" showtime.
  23. Add(new Show(
  24. title: "Inception",
  25. showDate: new DateTime(2025, 4, 11),
  26. showHour: new DateTime(2025, 4, 11, 20, 0, 0),
  27. numberOfSeats: 30));
  28. }
  29.  
  30. // Adds a single show to the catalog.
  31. public void Add(Show show) => _shows.Add(show);
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement