Programming
Programming
1. Analysis
2. Design: construction of program using standard methods
3. Coding: program is written and iterative testing is done.
4. Testing: program is tested for errors and whether it meets the requirements.
ANALYSIS
1. Abstraction: Discarding irrelevant information and keeping key elements of the problem.
2. Decomposition: Breaking down the program into inputs, processes, outputs and storage.
3. Identification of the problem: Identification of the requirements of the solution to the problem.
4. Research into the problem by data collection such as doing surveys
DESIGN
1. Structure Diagram: A hierarchical diagram showing the breakdown of a computer program into
sub-programs
2. Flowchart: A diagram showing the ordered steps to complete a computer program
3. Pseudocode: shows what a program does in plain language
WRITING in a file
CLOSEFILE MyPassword.txt
TEST DATA
BUBBLE SORT
Write an algorithm in pseudocode to sort the array Values[1:50] into ascending order using a bubble
sort.
Last 50
Repeat
Swap FALSE
THEN
Temp Values[Index]
Values[Index] Values[Index + 1]
Values[Index + 1] Temp
Swap TRUE
ENDIF
NEXT
Last Last – 1
LINEAR SEARCH
A linear search and a bubble sort are standard methods of solution. Fifty numbers are already stored in
the array Values[1:50]
Write an algorithm in pseudocode to input a number, MyNumber, and use a linear search to test if that
number is stored in the array. If the number is found in the array, the position in the array is output. If
the number is not found in the array, “Not found” is output
INPUT MyNumber
Location = 0
FOR Index = 1 TO 50
IF Values[Index] = MyNumber
THEN
Location Index
ENDIF
NEXT Index
IF Location = 0
THEN
ELSE
OUTPUT Location
ENDIF
ITERATIONS
Explain how the program can be written to make sure it can be easily maintained by the other
programmer.