Escolar Documentos
Profissional Documentos
Cultura Documentos
Mahfudzah Othman
UiTM Pahang
CHAPTER 1
2) Program Design
Define the solution of the problem
Programmer plans the solution
2 tasks:
Plan the solution (develop algorithm)
Document the solution
Several structured-programming techniques:
Top-down programming design
Logic structures
Pseudocode: An English like way to present the solution to a
problem
Flowcharts: A fictional representation of an orderly step by step
solution to a problem
Flowchart symbols:
1
CSC 125
Mahfudzah Othman
UiTM Pahang
3) Program Code
Select programming language
Write the program based on the design created in Step 2
Handwritten on paper/coding sheets
Follow the syntax of the chosen programming language
Entered into the computer
4) Program Test
Tested for errors after they are keyed into the computer
Testing a program debugging
Debugging involves eliminating all errors in program code
Logic error occurs when programming instructions do not
follow a logical sequence the produces correct
result
logic error that occur during the execution of a
program are called run-time logic errors
after output is obtained, after execution of
program are called output logic error
5) Program Documentation
Means: Writing a description of the purpose and process of the program
Consists of procedures about a program and how to use it
Should be done on a continual basis throughout all the steps of the
program development process.
2
CSC 125
Mahfudzah Othman
UiTM Pahang
Documentation is important for anyone who will involve with the program
in the future. Eg: Users, operators, and programmers.
6) Program Maintenance
Update software to correct errors, improve usability, standardize & adjust
to organizational changes.
3
CSC 125
Mahfudzah Othman
UiTM Pahang
Example 1:
Count the sum, average of two numbers
Requirement Specification:
Find the sum and average of 2 numbers
Analysis:
i) Formula :
Sum = number1 + number2
Average= sum/2
ii) Input:
Number1, number2
iii) Output
Sum, average
Design
Pseudocode:
1. input 2 values
2. Count
Add 2 values
Calculate the average of 2 values
3. Print Sum and average
Flowchart:
Start
Input 2 values
Calculate the
average
End
4
CSC 125
Mahfudzah Othman
UiTM Pahang
Example 2:
Calculate the area of one circle
Requirement Specification:
Find the area of a circle
Analysis:
i) Formula :
Area = pai * radius * radius
ii) Input:
Radius, pai=3.14
ii) Output
Area
Design:
Pseudocode:
1. input radius
2. pai = 3.142
3. Calculate the area by multiply pai and radius * radius
4. print area
Flowchart:
Start
Calculate the
area
Print area
End