Inputs, Processes and Outputs
Before you design an algorithm, identify the problem's inputs, processes and outputs. This makes clear what data enters the program, what work is done with it, and what results are produced, so the algorithm you design later has a job for every piece of data.
A car park ticket machine asks how many hours you want to park for and accepts coins. Breaking the problem down gives you:
| Part | What it covers |
|---|---|
| Inputs | the number of hours parking is needed, and each coin inserted |
| Processes | adding the coins to find the amount paid, multiplying the hours by the fixed hourly rate to find the cost, comparing the amount paid with the cost, subtracting the cost from the amount paid to find the change |
| Outputs | the printed ticket showing the hours paid for, the change returned, a message on the display |
Once the three lists are settled, the design is mostly about order: get the inputs, carry out the processes in a sensible sequence, then produce the outputs. The order is forced by the data, because the cost cannot be compared with the amount paid until the coins have been totalled.
OCR GCSE Computer Science · Inputs, Processes and Outputs