Transcript

PROGRAM DEVELOPMENT CYCLE

Problem Statement:

Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this stage include Algorithms and flowcharts for identifying the expected steps of a process. Therefore to solve any problem,

• Collect and analyze information and data • Talk with people familiar with the problem • If at all possible, view the problem first hand • Confirm all findings

An Algorithm: Baking a Cake

Algorithm: A predetermined series of instructions for carrying out a task in a finite number of steps.

An Algorithm: Baking a CakeAlgorithm: A predetermined series of instructions for carrying out a task in a finite number of steps.

Algorithm

• The Term Algorithm refers to the logic of a program. It is a step-by-step description of a solution to the given problem.

• When sequence of instructions are executed in the specified format and sequence the desired result are obtained.

• Definition:- A format or set of steps for solving a particular problem is called as algorithm.

• It has clear starting and stopping point. With specific step by step instructions in each line.

Characteristics of Algorithm

• Each instruction should be precise and clear.• Each instruction should be executed in a finite

time.• One or more instructions should not be

repeated Infinitely.• After executing the instructions the desired

result are obtained.• It range from Simple to the Complex.

Process of algorithm

• An algorithm must express the steps in the solution in a way that will be suitable for computer processing.

• It Read Value perform a simple procedure and output the required result.

• After algorithm a Flowchart is prepared and than it is run in the language form in the computer.

Algorithm: The algorithm is part of the blueprint or plan for the

computer program, an algorithm is: “An effective procedure for solving a class of problems in a

finite number of steps.”

Every algorithm should have the following 5 characteristic feature:

1. Input2. Output3. Definiteness4. Effectiveness5. Termination

Algorithm• To find largest of three numbers1) Start2) Read 3 numbers: num1, num2, num33) if num1 > num2 then go to step 54) if num2 > num3 then

print num2 is largest else

print num3 is largest goto step 65) if num1 > num3 then

print num1 is largest else

print num3 is largest6) end.

Flowchart• A Flowchart is a pictorial representation of an

algorithm.• It is a symbolic diagram of operation

sequence, dataflow, control flow and processing logic in information processing.

• The symbol used are simple and easy to learn.• It is a very help full tool for programmers and

beginners.

Purpose of flowchart

• Provide Communication.• Provide an overview.• Show all elements and its relationship.• Quick method of showing program flow.• Check program logic.• Facilitate coding.• Provide program revision.• Provide Program documentation.

Advantages of flowchart.

• Communication.• Effective analysis.• Proper documentation.• Efficient coding.• Proper debugging.• Efficient program maintenance.• Easy and clear presentation.

Limitation of flowchart

• Complex logic.• Drawing is time consuming.• Alteration and modification.• Redrawn many times.• Difficult to draw and remember.• Reproduction ( replica ).• Technical detail.

Symbols used in flowchart

• All symbols are of different shape and size.• All have specific meaning and use.

BASIC SYMBOLSTerminal Symbol = for start and stop.

INPUT and OUTPUT = Any function of input and output data.

Processing = An arithmetic and data movement instruction. Shows mathematical calculation and logic operations.

SYMBOLSDecision = Diamond indicate decision point in the program flow. IT may have 2 way branch or 3 way also.

Flow Lines = A Straight line between two boxes shows the path of logic flow in the program. An arrow head on the top of the line shows the direction of the flow, data from top to bottom and left to right.

Connectors = 2 small circles are used to connect separated portions of a flowchart without drawing lines between the parts. One connector indicated where the flow breaks off the other where it resumes.

Flowchart for finding the sum of first five natural numbers ( i.e. 1,2,3,4,5):

Flowchart (Example):Flowchart to find the sum of first 50 natural numbers.

Start

Read A, B

Is A > B

Print A Print B

End

Yes No

Flow Chart to find largest of two numbers:

Flowchart to find the largest of three numbers A,B, and C:

NO

LIMITATIONS OF USING FLOWCHARTS:

• Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.

• Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely.

• Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.

top related