Build a Study-Room Booking Checker
Scenario
A request is accepted only when a seat is free and the student has permission. Return a boolean. These examples cover both ways a request can fail.
Try it yourself
Predict the result for these requests. Then draw the two decisions and turn the cases into tests.
| Case | Result |
|---|---|
| 1 seat, permission granted | Select a choice above to see what happens. |
| 0 seats, permission granted | Select a choice above to see what happens. |
| 2 seats, permission denied | Select a choice above to see what happens. |
Reveal the explanation
- 1 seat, permission granted
Expected true. Both conditions hold.
- 0 seats, permission granted
Expected false. There is no seat to book.
- 2 seats, permission denied
Expected false. Permission is required.
Give your agent the flowchart and cases. Ask it to plan the function and tests, implement a small diff, and show the test output. Review the condition and commit the verified change.
Download shared test cases
Your turn
Submit your flowchart, acceptance cases, one implementation, and the actual test output.
Common mistake Implementing the seat rule and forgetting permission.
Check your work
Both decline branches are visible and the reviewed change passes all the stated cases.
Project brief
- Basic
- Draw both decisions and verify all three cases by hand.
- Intermediate
- Implement and test the full rule in one language. Show the focused diff and test output.
- Stretch
- Port it to a second language. Keep the same cases and add a check for invalid negative input with a documented result.
What to hand in
Include your diagram, expected-result table, code, actual test output, and the commit or diff you reviewed.
Review criteria
- Logic · Your diagram shows every required path and boundary.
- Verification · The tests exercise the stated acceptance cases and the recorded results match the code.
- Review · The change is focused and you can explain the decision it implements.
This browser could not save your progress. Changes last until you leave the page.