0% found this document useful (0 votes)
17 views15 pages

2.1 IPO Diagram To Pseudocode Part 1

The document discusses input-processing-output diagrams and pseudocode. It provides examples of IPO diagrams for making chocolate and painting a room. It also covers basic pseudocode statements and operations. Two exercises demonstrate writing pseudocode programs to calculate the sum and average of numbers.

Uploaded by

tumzaakiddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views15 pages

2.1 IPO Diagram To Pseudocode Part 1

The document discusses input-processing-output diagrams and pseudocode. It provides examples of IPO diagrams for making chocolate and painting a room. It also covers basic pseudocode statements and operations. Two exercises demonstrate writing pseudocode programs to calculate the sum and average of numbers.

Uploaded by

tumzaakiddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Input-Processing-Output Diagram

and Pseudocode
LECTURE OBJECTIVES
 Learn input-processing-output diagrams
 Learn pseudocode
Input-Processing-Output Diagram:
www.madehow.com
 Create chocolate slabs
INPUT PROCESSING OUTPUT
Sugar or other Cocoa beans are roasted to Chocolate Slab
sweetener remove moisture and
also to cause shells to
Cocoa beans separate from cocoa bean

Flavouring agents Crushing takes place.

Potassium Mix in cocoa butter.


Carbonate
Place in moulds.

Leave to cool.
Input-Processing-Output Diagram:
www.realsimple.com
 Painting a room
INPUT PROCESSING OUTPUT
INPUT
Colour Paint PROCESSING
Clean walls with water, OUTPUT
A painted room.
detergent and sponge. Leave
Water, mild detergent to dry.
and sponge
Tape bottom trim, window
Masking tape and door frames.

White primer paint Use roller/paint brush.


Mostly roller. Paint brush in
Roller hard to reach areas.
Prime the walls with “white”
Paint brush primer paint (more than once
?). Leave to dry. Paint using
your colour paint.

Remove bottom trim tape,


window and door frame tape,
and paint these areas.
Using Flowchart Symbols and
Pseudocode Statements
 Flowchart: pictorial representation of the logic
 Pseudocode: English-like representation of the logic
 Example: Flowchart and pseudocode of program that
doubles a number:
Using Pseudocode Statements
 Four Very Basic Programming Operations:

• DECLARE names (variables) to be used (num for


number or string for a mix of letters and numbers)

• INPUT (PROMPT and GET)

• CALCULATE (PROCESS)

• OUTPUT (DISPLAY)

Information Systems I will focus more on pseudocode.


This subject will focus more on coding – writing C#
code.
Using Pseudocode Statements
(continued)
 Words/symbols used in pseudocode:
• Indicate names to be used DECLARE

• Get Input INPUT: PROMPT & GET

• Process: CALCULATE
+ for Add - for Subtract
* for Multiply / for Divide
( ) for Parentheses

• Provide output OUTPUT: DISPLAY


Using Pseudocode Statements
Exercise 1
 Problem: Write a program that will calculate and display
the sum of two numbers.

 IPO Diagram:
INPUT PROCESSING OUTPUT
number1 number1 + number2 Display the sum of
number2 number1 and number2
Pseudocode Solution
INPUT PROCESSING OUTPUT
 Pseudocode: number1 number1 + number2 Display the sum of
number2 number1 and number2

START
DECLARE
num number1, num number2, num sum
INPUT
PROMPT for number 1
GET number1
PROMPT for number 2
GET number2
CALCULATE
sum = number1 + number2
OUTPUT
DISPLAY sum
STOP
 Please note the PROMPT implies the question is being
asked by the computer. You can use any wording in the
prompt. “Please enter a number” or
“Enter a number” or “Enter number 1”

Please enter a number: __

 The GET, CALCULATE and OUTPUT section need the


correct names (variable names). Names must be the
same names as in the DECLARE section.
Using Pseudocode Statements
(Exercise 2)
 Problem:
• Write a program that will calculate and display the
average of three numbers.

 IPO Diagram:
INPUT PROCESSING OUTPUT

number1 (number1 + number2 + number3) / 3 Display the average of the


number2 three numbers
number3
Using
INPUT Pseudocode
PROCESSING Statements OUTPUT

(Exercise
number1 2)
(number1 + number2 + number3) / 3
Display average
number2 of three numbers
number3
START
DECLARE
num …………, …………, …………, …………
INPUT
PROMPT for ………………………………………
GET ………………………………………
PROMPT for ………………………………………
GET ………………………………………
PROMPT for ………………………………………
GET ………………………………………
CALCULATE
average = ………………………………………
OUTPUT
STOP
DISPLAY ………………………………………
INPUT PROCESSING OUTPUT
Using Pseudocode Statements
number1 (number1 + number2 + number3) / 3 Display the average of
(Exercise
number2
2 - solution) the three numbers
number3
START
DECLARE
num number1, number2, number3, average
INPUT
PROMPT for Number 1
GET number1
PROMPT for Number 2
GET number2
PROMPT for Number 3
GET number3
CALCULATE
average = (number1 + number2 + number3)/3
OUTPUT
DISPLAY average
STOP
Using Pseudocode Statements
(Exercise 2 Program)

Wording that you see above would


be in the actual prompting AND
output (display)
PROMPT AND
DISPLAY WORDING
START
DECLARE
num number1, number2, number3, average
INPUT
PROMPT “Please enter number 1: “
GET number1
PROMPT “Please enter number 2: “
GET number2
PROMPT “Please enter number 3: “
GET number3
CALCULATE
average = (number1 + number2 + number3)/3
OUTPUT
DISPLAY “The average is “ + average

STOP

You might also like