Beruflich Dokumente
Kultur Dokumente
external documentation
Pseudocode
Flowchart
IPO Chart
The Input-Process-Output chart also known as
IPO Chart
The INPUT section contains all input data to be
IPO Chart
Has Three
sections:
the Input
the Processing
the Output
processing
Output
Pay_rate
1.Prompt and
Get
Pay_rate
Pay
2. Calculate
Pay
3. Print Pay
4. End
times does the heart beat in a lifetime of 78 years? (use 365.25 for
days in a year). Write a program that can calculate the total heart
beats as the heart rate (beat per minute) and the lifetime are
provided by user.
IPO chart
INPUT
PROCESS
OUTPUT
heart_rate
lifetime
1.
2.
3.
4.
total_heart_beat
in a tax rate (as a percentage) and the prices of three items. The
program is to calculate the total price, before tax, of the items,
then the tax payable on those items. The tax payable is
calculated by applying the tax rate percentage to the total
price. Print the total price and the tax payable as output.
IPO chart
INPUT
PROCESS
OUTPUT
taxrate
item1
item2
item3
Algorithm
Eventually end
Must be complete
Algorithm
Representation of algorithm:
A.Pseudocode
B.Flowcharts
Pseudocode
Pseudocode
Algorithm in simple English (All statements are
Pseudocode
Remember all the keywords for six basic
computer operations?
Pseudocode
One : A computer can receive information
Read student_name
Get system_date
Get tax_code
Pseudocode
Two : a computer can put out information
Output total_tax
Pseudocode
Three : a computer can perform arithmetic
Pseudocode
Four: A computer can assign a value to a
variable or memory location
Set student_count to 0
total_price = cost_price
Store customer_num in last_customer_num
Pseudocode
Five: A computer can compare two variables
and select one of two alternate actions
IF student_attendance_status = part_time
THEN
add 1 to part_time_status
ELSE
add 1 to full_time_count
ENDIF
Pseudocode
Six: A computer can repeat a group of
actions
DOWHILE student_total < 50
Read student_record
Print student_name,
Add 1 to student_total
ENDDO
Pseudocode
Example
A Program is required to prompt the terminal operator for the maximum
and minimum temperature readings on a particular day, accept those
readings as integers, and calculate and display to the screen the average
temperature, calculated by (maximum temperature + minimum
temperature)/2
IPO Chart
Input
Process
Output
max_temp
min_temp
avg_temp
Pseudocode
Find_average_temperature
Prompt operator for max_temp, min_temp
Get max_temp, min_temp
Pseudocode example
If a human heart beats on the average of once a second, how many
times does the heart beat in a lifetime of 78 years? (use 365.25 for
days in a year). Write a program that can calculate the total heart
beats as the heart rate (beat per minute) and the lifetime are
provided by user.
Find_total_heart_beat
Prompt and get for heart_rate
Prompt and get for lifetime
total_heart_beat = lifetime * heart_rate * 60 * 24 * 365.25
Display total_heart_beat to screen
END
PROCESS
OUTPUT
heart_rate
lifetime
1.
2.
3.
4.
total_heart_beat
Find_total_heart_beat
Prompt and get for heart_rate
Prompt and get for lifetime
total_heart_beat = lifetime * heart_rate * 60 * 24 * 365
Display total_heart_beat to screen
END
in a tax rate (as a percentage) and the prices of three items. The
program is to calculate the total price before tax of the items,
then the tax payable on those items. The tax payable is
calculated by applying the tax rate percentage to the total
price. Print the total price and the tax payable as output.
IPO chart
INPUT
PROCESS
OUTPUT
taxrate
item1
item2
item3
Flow Chart
Flow Chart
Find_average_temperature
Prompt and Get for max_temp
Prompt and Get for min_temp
avg_temp = (max_temp + min_temp)/2
Display avg_temp to the screen
END
Flowchart example
Start
Prompt
and get
for
heart_rate
Find_total_heart_beat
Prompt and get for heart_rate
Prompt and get for lifetime
total_heart_beat = lifetime * heart_rate * 60 * 24 * 365.25
Display total_heart_beat to screen
END
Prompt
and get
for
lifetime
total_heart_b
eat = lifetime
*
heart_rate
* 60 * 24 *
365.25
Display
total_hea
rt_beat
Stop
Designing Solutions
Using Logic Structure (Structured Theorem)
Assist programmer in writing effective error free
programs.
Possible by write the computer program by using Three
control structures
Statemement b
Statemement c
F
Condition?
Statemement a
Statemement b
Case Structure
Case
Of
variable
Value 1
Statement_a
Value 2
Value 3
Value 4
Statement_b
Statement_c
Statement_d
3. Repetition
Defined as the presentation of a set of instruction to
be performed repeatedly
Block of statement is executed again and again until a
terminating condition occurs
Three loop structure :
FOR
WHILE
DO-WHILE
prefix
condition
FOR Loop
statement
update
stop
condition
update
T
statement
T
stop
WHILE
Loop
DO-WHILE
Loop
statement
update
F
Condition
T
stop
Internal documentation
internal documentation
internal documentation consists of the comments
information as possible.
Names of variables, types, constants, and field
External documentation
may include as a long comment right at the beginning
Start
Prompt for
Block_length,
Block_width
GET for
Block_length,
Block_width
Prompt for
House_length,
House_width
Get for
House_length,
House_width
mowing_area =
(Block_length* Block_width)
(House_length*House_width)
mowing _time =
mowing_area/2
Display
mowing_time
Stop