22
COMPUTER PROGRAMMING Lecture 02 Prepared By Mr. V. S. Patil Dept (CSE)/AEC

COMPUTER PROGRAMMING UNIT 1 Lecture 2

Embed Size (px)

Citation preview

COMPUTER PROGRAMMING

Lecture 02

Prepared By Mr. V. S. Patil Dept (CSE)/AEC

Unit 1 Problem SolvingSyllabus

Prepared By Mr. V. S. Patil Dept (CSE)/AEC

2

1 To understand the basics of problem solving

on computers

To solve any real life or program problem

Objectives

• Basic concept of problem on computer…

• For solving problem on computer following steps are required.

(This steps called as Software Life Cycle. )

1) Problem Statement:-

• The Problem statement should be clear and unambiguous.

• If the statement is not precise and clear, the design and

implementation will be erroneous.

2) Problem Analysis and Design:-

• This step is very crucial step in writing a program.

• The problem should analyzed to find the most efficient way in

which it can be solve.

• An algorithm to solve the problem is developed based on the

analysis.

continue..

3) Analysis of the algorithm:-

The algorithm should be analyzed to check if it is perform the

desired action using a reasonable amount of time and memory.

4) Coding:-

This step involves coding the algorithm using an appropriate

language to form a program.

• The choice of a programming language depends on a several factor.

5) Documentation:-

• Documentation is essential to make the program easy to

understand.

• It informs the reader about the working of program.

Continue..

6) Testing:-

• The program should be tested thoroughly using all the possible

type of input.

• Testing detects incorrectness of program if any.

7) Maintenance:-

• The program may require changes depends on its application.

• The changes and updates required are perform during

maintenance.

Problem Solving is easy if you follow these steps

Understandthe

problem

• Read the problem carefully.

• Find the important information.

• Write down the numbers.

• Identify what the problem wants you to solve.

• Ask if your answer is going to be a larger or smaller

number compared to what you already know.

Step 1 – Understand the problem

Step 1 - Understand the ProblemRead the problem carefully.

•Luis earned 14 Accelerated Reading points the first week

of November. At the end of the following week he had a

total of 31 points. How many points did he earn the

second week?

• Luis earned 14 Accelerated Reading points the first

week of November. At the end of the following week he

had a total of 31 points.

• How many points did he earn the second week?

Step 1 - Understand the ProblemFind the important information.

• Luis earned 14 Accelerated Reading points the first week

of November. At the end of the following week he had a

total of 31 points. How many points did he earn the

second week?

Step 1 - Understand the ProblemWrite down the numbers.

Total = 31 1st week =14

Step 1 - Understand the ProblemIdentify what the problem wants you to solve

Luis earned 14 Accelerated Reading points the first week of

November. At the end of the following week he had a total of

31 points. How many points did he earn the second week?

Total = 31 1st week =14

2nd week = ?

Step 1 - Understand the Problem

Ask if your answer is going to be a larger or smaller number compared to what you already know.

• It will be smaller than the total but may or may not be smaller than the first week.

Total = 31 1st week =14

2nd week = ?

Problem Solving is easy if you follow these steps

Decide howyou’re going

to solve theproblem

Step 2 - Decide how you’re going to solve the problemChoose a method

Use a graph Use formulas

Write an equation Make a list

Find a pattern Work backwards

Use reasoning Draw a picture

Make a table Act it out

Step 2 - Decide how you’re going to solve the problemWrite your equation

• Since I know both weeks total 31 I write

14 + s = 31• I can use the inverse operation to solve

14 + s = 31 31 – 14 = s

Total = 31 2nd week = ?

1st week =14

Problem Solving is easy if you follow these steps

Solve The

Problem

31-14=17

Problem Solving is easy if you follow these steps

LookBack &Check

Step 4 - Look Back & CheckReread the problem

•Luis earned 14 Accelerated Reading points the first week

of November. At the end of the following week he had a

total of 31 points. How many points did he earn the second

week?

•Total=31 1st week=14

Step 4 - Look Back & CheckSubstitute your new number

•Luis earned 14 Accelerated Reading points the first week

of November. At the end of the following week he had a

total of 31 points. How many points did he earn the second

week?

•Total=31 1st week=14

2nd week=17

•14+17=31

Step 4 - Look Back & CheckDid your new number work?

14+17=31 Yes

Question Bank

1.Explain the steps involved in problem solving on

computer

2.Write down the steps to solve following problem.

i) Addition of two numbers.

ii) To calculate Area of circle