Você está na página 1de 5

CSC 125

Mahfudzah Othman
UiTM Pahang

CHAPTER 1

PROBLEM SOLVING PHASES

The Six-Step Program Development Process

1) Program Specification (Program Definition/Program Analysis)


 Follow 5 specific tasks:
 Specify object
 Specify input
 Specify output
 Specify processing requirements
 Document specification

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:

SYMBOL NAME DESCRIPTION


Terminal Indicates the beginning
or end of an algorithm

Input/Output Indicates an input or


output operation

Process Indicates computation or


data manipulation

Flow lines Used to connect the


flowchart symbols &
indicates the logic flow

1
CSC 125
Mahfudzah Othman
UiTM Pahang

Decision Indicates a decision point


in the algorithm

Loop Indicates the initial, final


& increment values of a
loop

Predefined process Indicates a predefined


process, as in calling a
sorting process

Connector Indicates an entry to, or


exit from another part of
the flowchart

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.

 User Documentation users need to know the software.


 documentation may be used to guide users to the
program.
 users maybe expected to learn a program from
return document alone.
 manuals accompany the software when
purchased.

 Operator Documentation to guide them running program


 to translate error message

 Programmers Documentation to update/modify the program


(need to know the purpose & the
logic of a program).
 include flowcharts, program distinct &
sample output.
 document should also show how the
program relate to other programmer within
an IS.

6) Program Maintenance
 Update software to correct errors, improve usability, standardize & adjust
to organizational changes.

3
CSC 125
Mahfudzah Othman
UiTM Pahang

Examples of using Algorithm to solve problems

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

Print the sum &


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

Input radius &


pai =3.142

Calculate the
area

Print area

End

Você também pode gostar