Your GAA club books a 30-seat bus. Why might only 28 seats be usable?
Your GAA club books a bus with thirty seats for an away match. One passenger will travel in their wheelchair. To use the wheelchair bay, you have to fold away two of those thirty seats. How would a booking program work out whether everyone fits?
Start with what goes into the program. The booking list tells you whether each passenger needs a seat or the wheelchair bay. Now think about what comes out. The program tells you whether the group fits. If it fits, it also tells you how many usable seats are free.
Start with the booking list. Read each booking once and add one to the seat tally or the bay tally. Pass both counts to allocation. It sends whether the group fits and, if so, the usable and reserved seat counts to reporting. Splitting a problem into solvable tasks is called decomposition.
The counting task has finished. Allocation needs to know how many passengers need seats and how many need the wheelchair bay. What should counting pass to allocation? Pick the option that gives it both pieces of information.
First choose a layout. With no bay requests, you have thirty usable seats. With one request, folding away two seats leaves twenty-eight. With two or more requests, stop: the group cannot fit. Otherwise, compare seat requests with usable seats. If there are enough, reserve the requested places.
Of twenty-five bookings, one is for the bay, so twenty-four passengers need seats. Folding away two seats leaves twenty-eight usable seats. Twenty-four is less than or equal to twenty-eight, so you can reserve all the requested places. Subtract the twenty-four reserved seats from twenty-eight to report four free seats.
This time there are twenty-eight bookings, including one passenger who will travel in their wheelchair. Follow the same three tasks. How many usable seats should the program report as free after everyone has a place? Pick an answer.
A common exam slip is to list stages like plan, code and test. Those tell you when work happens. A useful breakdown tells you what each task solves. You could test the counting task on its own by giving it bookings and checking the two counts.
If you only need to check fit and report free seats, the program can compare counts and subtract, without storing individual seat assignments. For numbered tickets, keep the same fit check, then scan a seat list. Skip folded or taken seats. For each passenger needing a seat, record one and mark it taken.
If the question asks you to describe how you would decompose the bus booking problem, give each task a specific job. State what it takes in and what it passes on. For allocation, explain how a bay request changes the number of seats available.