Practice
Sports Club Membership System
2025/Feb/Mar
HARDArrays
A sports club uses a six-character alphanumeric membership code. Manage members using three 1D arrays: MemberID, FirstName, and LastName.
The menu must offer three options:
- Input a new member (validate code length = 6, then check uniqueness)
- Output all stored members
- Stop
For each new member: validate the code is exactly 6 characters, check it is unique, then store the code, first name, and last name. Invalid menu input should prompt the error "You must input 1, 2 or 3. Please try again".
Arrays sized for up to 5 members.
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Immediate stop
Inputs: 3
Expected: Enter 1 to input, 2 to output, 3 to stop
Test 2: Add one member and list
Inputs: 1, 123456, Alice, Smith, 2, 3
Expected: Enter 1 to input, 2 to output, 3 to stop
Enter a new six-character membership code
Enter your first name
Enter your last name
Enter 1 to input, 2 to output, 3 to stop
Membership code: 123456
First name: Alice
Last name: Smith
Enter 1 to input, 2 to output, 3 to stop
Test 3: Triggers length validation
Inputs: 1, SHORT, 123456, Bob, Jones, 3
Expected: Enter 1 to input, 2 to output, 3 to stop
Enter a new six-character membership code
The code must contain six characters, please try again.
Enter a new six-character membership code
Enter your first name
Enter your last name
Enter 1 to input, 2 to output, 3 to stop
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade