Preview

exam

Satisfactory Essays
Open Document
Open Document
373 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
exam
Developing an algorithm

Objectives
To introduce methods of analysing a problem and developing a solution
To develop simple algorithms using the sequence control structure
To introduce methods of manually checking the developed solution

Methos of analysing a problem and developing a solution
1) Defining the problem
2) Designing a solution algorithm
3) Checking the solution algorithm

1) Defining the Problem
Problem should be divided into three separate components:
1. Input: a list of source data provided to the problem
2. Output: a list of the outputs required
3. Processing: a list of actions needed to produce the required outputs

When reading a problem statement, the input and output components are easily identified due to the use of descriptive words such as nouns and adjectives
Processing component is also identified easily as the problem statement usually describes the processing steps as actions, using verbs and adverbs

Example 1 : Add three numbers

A program is required to read three numbers add them together and print their total.

a) Underlined nouns and adjectives to identify the input and output components of this problem.

A program is required to read three numbers add them together and print their total.

b) Underlined the verbs and adverbs to identify the processing component of this program.

A program is required to read three numbers add them together and print their total.

c) Construct an IPO(Input, Processing, Output) chart.
Input
Processing
Output
number1 number2 number3
Read three numbers
Add numbers together
Print total number total 2) Designing a solution algorithm

Based on the defining IPO chat that developed in defining the problem step, a solution algorithm is design as follows:

Start read number1, number2, number3 total = number1+ number2+ number3 print total
Stop

3) Checking the solution algorithm
Based on the solution algorithm that designed in previous step, a desk

You May Also Find These Documents Helpful

Related Topics