[go: up one dir, main page]

0% found this document useful (0 votes)
8 views44 pages

Tools of Problem Analysing

The document covers programming fundamentals, focusing on problem analysis tools such as IPO charts, algorithms, and flow charts. It provides examples of how to apply these tools to solve various programming problems, including calculating areas, averages, and conversions. Each example includes an IPO chart, algorithm, and flow chart to illustrate the problem-solving process.

Uploaded by

fayazahmex561
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)
8 views44 pages

Tools of Problem Analysing

The document covers programming fundamentals, focusing on problem analysis tools such as IPO charts, algorithms, and flow charts. It provides examples of how to apply these tools to solve various programming problems, including calculating areas, averages, and conversions. Each example includes an IPO chart, algorithm, and flow chart to illustrate the problem-solving process.

Uploaded by

fayazahmex561
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/ 44

Lecture – 05 & 11

Programming Fundamentals
BS Information Technology – First Semester

By: Ms. Mahnoor Buriro, Research Associate, TUMS


Contents

• Problem analysis tools


• IPO (Input, Process, Output) chart
• Algorithm
• Flow Chart
• Problem Examples

2
Problem analysis tools

3
Problem analysis tools

• Problem analysis tools help you analyze the problem to have a clear picture
of the problem.

• They help you identify the problems and their causes at the beginning.

• They help you better understand the problem by conducting its


postmortem.

4
Problem analysis tools

• The problem analysis tools that we will be using to solve problem are:

5
IPO Chart

• IPO stands for Input Process Output.

• It performs the analysis by identifying the input, process and output of a


given problem.

6
IPO Chart

• It can be represented by the following chart:


Input Processing Output
Processing Items:

Algorithm:

7
IPO Chart
• The input section specifies all the inputs to the problem.

• The input may be given by the user from input devices like, keyboard,
mouse, scanner etc.

• The input may also come as the contents of a file.

• The input may come from the network or Internet.

8
IPO Chart
• The output section specifies all the outcomes of the problem.

• The output may be in the form of the presenting the results on the
monitor screen, printer or any other output device.

• The output may also be stored in a file.

• The output may be redirected to network or Internet.

9
IPO Chart

• The processing section specifies two things: processing items and algorithm.

• The processing items involve any formula or equation to be used while


processing.

• The algorithm is the step by step processing procedure to solve that task.

10
Algorithm

• Algorithm is the representation of a solution to a problem.

• It is step by step procedure to solve a given problem.

• An algorithm contains finite number of instructions in order to solve a


problem.

11
Algorithm
• For example, calculating the average of three numbers.

Step 01: Start


Step 02: Input number1, number2 and number3 from the user
Step 03: Calculate average as: average = (number1 + number2 +
number3)/3
Step 04: Print average
Step 05: End

12
Flow Chart

• Flow chart is the pictorial representation of a process or an algorithm.

• It uses symbols (boxes of different shapes) to represent each step of an


algorithm.

• All the symbols are then connected with arrows to show the flow of the
process.

13
Flow Chart
Symbol Name Meaning

Terminal Indicates the beginning and end points


(Oval) of an algorithm.

Process Shows an instruction other than input,


(Rectangle) output or selection.

14
Flow Chart
Symbol Name Meaning

Input-Output
Shows an input or output instruction.
(Parallelogram)

Decision Shows any point in the process where


(Diamond) decision is to be made.

15
Flow Chart
Symbol Name Meaning

On-Page Continues and connects the flowchart


Connector on the same page.

Off-Page Continues and connects the flowchart


Connector on another page.

16
Flow Chart
Symbol Name Meaning

Denotes movement to another process


Sub-Process
and hence a new flowchart

Connects symbols and shows flow of the


Arrows
process or algorithm.

17
Problem Examples
IPO Charts, Algorithms and Flow Charts

18
Problem 01: Area of rectangle

Problem Statement: Write a program that accepts the width


and the height of a rectangle from the user and prints the area of
the rectangle.

19
Problem 01 - IPO Chart and Algorithm

Input Processing Output


• Width of rectangle Processing Items: • Area of rectangle
• Height of rectangle area = width * height

Algorithm:
Step 01: Start
Step 02: Input width and height from the user
Step 03: Calculate area as: area = width *
height Step 04: Print area
Step 05: End

20
Problem 01 – Flow Chart

21
Problem 02 : Average of three numbers

Problem Statement: Write a program that accepts three


numbers from the user and displays the average of the numbers.

22
Problem 02 - IPO Chart and Algorithm
Input Processing Output
• First number Processing Items: • Average of numbers
• Second number average = (number1 + number2 + number3)/3
• Third number
Algorithm:
Step 01: Start
Step 02: Input number1, number2 and number3
from the user
Step 03: Calculate average as: average =
(number1 + number2 + number3)/3
Step 04: Print average
Step 05: End

23
Problem 02 – Flow Chart

24
Problem 03 : Temperature scale conversion

Problem Statement: Write a program that receives


the temperature in Celsius from the user and displays the
temperature in Fahrenheit and Kelvin.

25
Problem 03 - IPO Chart and Algorithm
Input Processing Output
• Temperature in Processing Items: • Temperature in
Celsius F = C * 1.8 + 32 Fahrenheit
K = C + 273.15 • Temperature in
Kelvin
Algorithm:
Step 01: Start
Step 02: Input Celsius c from the user
Step 03: Calculate Fahrenheit temperature as:
f = (c * 1.8) + 32
Step 04: Calculate Kevin temperature as:
k = c + 273.15
Step 05: Print f and k
Step 06: End

26
Problem 03 – Flow Chart

27
Problem 04 : Area and circumference of a
circle

Problem Statement: Write a program that receives the radius


of the circle from the user and displays the area and circumference
of the circle.

28
Problem 04 - IPO Chart and Algorithm
Input Processing Output
• Radius of circle Processing Items: • Area of circle
area = • Circumference of
circumference = circle
Algorithm:

29
Problem 04 - IPO Chart and Algorithm
Input Processing Output
• Radius of circle Processing Items: • Area of circle
area = π * radius^2 • Circumference of
circumference = 2 * π * radius circle

Algorithm:
Step 01: Start
Step 02: Input radius from the user
Step 03: set PI = 3.1415
Step 04: Calculate area as: area = PI * radius^2
Step 05: Calculate circumference as:
circumference = 2 * PI * radius
Step 06: Print area and circumference
Step 07: End

30
Problem 04 – Flow Chart

31
Problem 05 : Buntty, Bubbly and
Building
Problem Statement: There are two friends Buntty and
Bubbly. Buntty is standing at the top of a vertical building and
Bubbly is standing on the ground away from the building. Write
a program that displays the distance of Bubbly from the building
after asking the user about the length of the building and the
distance between Buntty and Bubbly.

32
Problem 05 - IPO Chart and Algorithm
Input Processing Output
• Distance Processing Items: • Distance of
between Hyp2 = Base2 + Perp2 Bubbly from
Buntty and Hyp = Distance b/w Buntty and Bubbly the building
Bubbly Base = Distance b/w Bubbly and building
Perp = Height of building
• Height of the Base = 𝐻𝑦𝑝 2 + 𝑃𝑒𝑟𝑝2
Building
Algorithm:
Step 01: Start
Step 02: Input Dis_Bun_Bub, Height_Bui from the user
Step 03: Calculate Distance b/w Bubbly and building as:
Dis_Bub_Bui = 𝐷𝑖𝑠_𝐵𝑢𝑛_𝐵𝑢𝑏2 + 𝐻𝑒𝑖𝑔ℎ𝑡_𝐵𝑢𝑖2

33
Problem 05 - IPO Chart and Algorithm
Input Processing Output
Step 04: Print Dis_Bub_Bui
Step 05: End

34
Problem 05 – Flow Chart

35
Problem 06 : Even or odd number

Problem Statement: Write a program that receives an


integer number from the user and displays whether it is an even
number or an odd number.

36
Problem 06 - IPO Chart and Algorithm
Input Processing Output
• Integer number Processing Items: • Number is
If (number MOD 2) = 0 then it is even odd or even
If (number MOD 2) ≠ 0 then it is odd

Algorithm:
Step 01: Start
Step 02: Input number from the user
Step 03: if (number MOD 2) == 0 then GOTO Step
04 else GOTO Step 05
Step 04: Print “Number is even” GOTO Step 06
Step 05: Print “Number is odd”
Step 06: End

37
Problem 06 – Flow Chart

38
Problem 07 : Positive numbers

Problem Statement: Write a program that receives an


integer number from the user. If the number is positive then
display that number.

39
Problem 07 - IPO Chart and Algorithm
Input Processing Output
• Integer number Processing Items: • Number if it
If (number > 0) then it is positive is positive

Algorithm:
Step 01: Start
Step 02: Input number from the user
Step 03: if (number > 0) then GOTO Step 04 else
GOTO Step 05
Step 04: Print number
Step 05: End

40
Problem 07 – Flow Chart

41
Problem 0 8 : First 10 integer numbers

Problem Statement: Write a program that generates and


displays first 10 integer numbers.

42
Problem 0 8 - IPO Chart and Algorithm
Input Processing Output
Processing Items: • First 10
1, 2, 3, . . . , 10 integer
numbers
Algorithm:
Step 01: Start
Step 02: Set i = 1
Step 03: Repeat Step 04 to Step 05 while i <=10
Step 04: Print i
Step 05: Set i = i +
1 Step 06: End

43
Problem 0 8 – Flow Chart

44

You might also like