Practice
Parking Booking Validator
2022/Oct/Nov·Variant 2
EASYValidation
A visitor car park booking system requires the user to input the day they want to book within a two-week period (days 1 to 14).
Write a program that repeatedly takes an integer input. If the input is outside the valid range (1 to 14 inclusive), output "Invalid day" and ask again. Once a valid day is entered, output "Accepted: " followed by the day number and terminate.
Input: A sequence of integers. Output: "Invalid day" for out-of-range inputs, then "Accepted: X" for the valid input.
Example:
Input: 0
15
14
Output: Invalid day
Invalid day
Accepted: 14
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Testing boundaries
Inputs: 0, 15, 14
Expected: Invalid day
Invalid day
Accepted: 14
Test 2: Valid day immediately
Inputs: 1
Expected: Accepted: 1
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to check