02 Program Design PDF
02 Program Design PDF
02 Program Design PDF
Program Design
Bimo Sunarfri Hantono
Defining Diagram:
Input Processing Output
Number1 Total
Number2
Number3
Example 1. Add Three Number
• A program is required to read three numbers, add them
together and print their total.
Defining Diagram:
Input Processing Output
Number1 Total
Number2
Number3
Example 1. Add Three Number
• A program is required to read three numbers, add them
together and print their total.
Defining Diagram:
Input Processing Output
Number1 Read three numbers Total
Number2 Add numbers together
Number3 Print total number
Example 2. Find average temperature
• 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.
Example 2. Find average temperature
• 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.
Defining Diagram:
Input Processing Output
Max_temp Avg_temp
Min_temp
Example 2. Find average temperature
• 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.
Defining Diagram:
Input Processing Output
Max_temp Prompt for temperatures Avg_temp
Min_temp Get temperatures
Calculate average temperature
Display average temperature
Example 3. Compute mowing time
• A program is required to read from the screen the length and
width of a rectangular house block, and the length and width
of the rectangular house that has been built on the block. The
algorithm should then compute and display the mowing time
required to cut the grass around the house, at the rate of two
square meters per minute.
Example 3. Compute mowing time
• A program is required to read from the screen the length and
width of a rectangular house block, and the length and width
of the rectangular house that has been built on the block. The
algorithm should then compute and display the mowing time
required to cut the grass around the house, at the rate of two
square meters per minute.