Explain the stages of program development with an example.
5 marks
Answer in brief
Program development is the process of understanding a problem, planning its solution, writing the program, testing it and maintaining it.
Stages of program development
Problem analysis: Understand what the program must do. Identify the inputs, outputs and limits on the input values.
Solution design: Prepare an algorithm, pseudocode or flowchart. Choose the steps needed to solve the problem.
Coding: Write the planned solution in a programming language such as C. Use suitable variables, operators and statements.
Compilation: Translate the source program. Read the compiler messages and correct syntax mistakes.
Testing and debugging: Run the program with different inputs. Compare its output with the expected result. Find and correct the causes of wrong results.
Documentation and maintenance: Write useful notes about the program. Update it when requirements change or a mistake is found.
Example: average of three marks
Inputs: three marks. Output: their average. First add the marks, then divide the total by 3.0. In C, using 3.0 allows a fractional result when the total is an integer. For marks 60, 75 and 90, the total is 225 and the average is 75.
Testing
Try ordinary values, boundary values and invalid values. If marks must be between 0 and 100, the program should check that rule. Testing finds a failure; debugging finds and fixes its cause. If a change introduces another mistake, test the corrected program again. Successful compilation alone does not prove that the answer is correct.