+ All Categories
Home > Documents > End Show Writing a computer program involves performing the following tasks. 1. Understanding the...

End Show Writing a computer program involves performing the following tasks. 1. Understanding the...

Date post: 13-Jan-2016
Category:
Upload: christopher-small
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
25
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3. Writing a Computer Program 4. Testing the Computer program Different steps in solving a problem Solving a problem T Department - National Institute of Education
Transcript
Page 1: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Writing a computer program involves performing the following tasks.

1. Understanding the problem

2. Developing an Algorithm for the

problem

3. Writing a Computer Program

4. Testing the Computer program

Different steps in solving a problem

Solving a problem

IT Department - National Institute of Education

Page 2: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Lets take a problem and try to solve the problem

Add two numbers and display total.

Problem :

IT Department - National Institute of Education

Page 3: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

How do you solve that problem ?

The first task is to understand the problem clearly

STEP 1 – Understand the problem

Here the input should be two numbers.

Find out the inputs ?

IT Department - National Institute of Education

Page 4: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

That is Process.

Find outputs ?

Total.

So there must be some calculation to get the total.

IT Department - National Institute of Education

Page 5: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

STEP 2 – Developing an Algorithm for the problemThe method that used to solve the problem is called algorithm

Algorithm can be represented in two ways

1. Graphically

2. Textually

IT Department - National Institute of Education

Page 6: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

Boil water

Add some sugar

Put tea powder to mug

Start

Stop

Serve

A Graphical representation of making a cup of tea

This Representation is called as Flow Chart

IT Department - National Institute of EducationEnd Show

Page 7: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

A graphical representation of the sequence of operations in a program is called Flow Chart.

Flowchart

flowchart shows how data flows and operates

IT Department - National Institute of Education

Page 8: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Symbols used in Flow chart

Start/Stop

Input/Output

Decision

Flow line

Process

Yes

No

IT Department - National Institute of Education

Page 9: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

Calculate total

Start

Stop

A Graphical representation to add two numbers

This Representation is called as Flow Chart

Input two numbers

Display total

IT Department - National Institute of EducationEnd Show

Page 10: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Draw a flow chart to find adult or child.

Stop

Input Age

If age>=18 Adult child

Start

Yes No

IT Department - National Institute of Education

Page 11: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Draw a flow chart to cross the road.

Are clear both ways?

Go to pavement

No

Cross the road Wait

Yes

Start

Stop

Look at left & right

IT Department - National Institute of Education

Page 12: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Draw a flow chart to find the correct key from a bunch keys to open the door.

Can the door be opened

Tryout a key

No

Try the next key

Yes

Start

Stop

IT Department - National Institute of Education

Page 13: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Input name, Maths and Science marks and calculate Total.

Display Name & Total Marks .

Solve & design the above problem in Flow chart.

Problem Solving 1

IT Department - National Institute of Education

Page 14: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

Start

Input Name, Maths Mks , Science Mks

Total= Maths + Science

Display Name,Total

Stop

Conti..

IT Department - National Institute of Education

End Show

Page 15: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Problem Solving 2

Draw Flow chat to input Average Marks and display Pass or fail

(If Average>= 60 , “Pass” otherwise “Fail”)

IT Department - National Institute of Education

Page 16: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Start

If Avg>=60

No

PASS

Display Grade

FAIL

Stop

Yes

Input Average

IT Department - National Institute of Education

Page 17: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

75 - 100 “A”65 - 74 “B”55 - 64 “C”45 - 54 “S”0 - 44 “F”

Draw a flow chart to input Average Marks and find the grade according to the grade System given below.

Problem Solving 3

IT Department - National Institute of Education

Page 18: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Input Avg If Avg>=75

If Avg>=65

If Avg>=55

If Avg>=45

Stop

Start Display A

Display B

Display C

Display S

Yes

Yes

Yes

Yes

No

No

No

No

Display F

IT Department - National Institute of Education

Page 19: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Start

Is Number < =10

No

Print Number

Stop

Yes

Number=1

Number=Number+1

Draw a flow chart to print numbers from1 to 10

IT Department - National Institute of Education

Page 20: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

One of the textual representation of algorithm is Pseudo code.

Pseudo Code

IT Department - National Institute of Education

Page 21: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Begin

Pseudo Code for adding two numbers

End.

Input first number and second number

Total = first Number + Second Number

output Total

IT Department - National Institute of Education

Page 22: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Begin Input Maths Marks ,Science Marks Total = Maths + Science Average = Total / 2 If Average >= 60 then Grade= “PASS” Else Grade= “FAIL” End if Display Total , Average , GradeEnd

Write a pseudo code to take maths and science marks , calculate total, average and display grade.(If average >=60, “Pass” otherwise “Fail”.

IT Department - National Institute of Education

Page 23: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

75 - 100 “A”65 - 74 “B”55 - 64 “C”45 - 54 “S”0 - 44 “F”

Write a pseudo code to input Average Marks and find the grade according to the grade System given below.

IT Department - National Institute of Education

Page 24: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

Begin

Input Avg Mks

If Avg >=75 then Grade = “A” Else

If Avg >=65 then Grade =“ B” Else

If Avg >=55 then Grade = “C” Else

If Avg >= 45 then Grade =“ S” Else

Grade = “W”

End if

End if

End if

End if

Display Grade

End

IT Department - National Institute of Education

Page 25: End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.

End Show

BeginNumber=1Do While Number <=10Print NumberNumber=Number + 1End while

End

Write a Pseudo code to display numbers from 1 to 10

IT Department - National Institute of Education


Recommended