using System; internal static class Program { private static void Main(string[] args) { var session = new BookingSession(8); Console.WriteLine($"First: {session.Reserve(5)}"); Console.WriteLine($"Excess: {session.Reserve(4)}"); Console.WriteLine($"Exact: {session.Reserve(3)}"); Console.WriteLine($"Reserved: {session.Reserved}"); } } internal sealed class BookingSession { public int Capacity { get; } public int Reserved { get; private set; } public BookingSession(int capacity) { if (capacity is < 1 or > 1000) throw new ArgumentOutOfRangeException(nameof(capacity)); Capacity = capacity; } public bool Reserve(int requested) { if (requested < 1 || requested > Capacity - Reserved) return false; Reserved += requested; return true; } }