940 likes | 952 Views
Learn about Noornilo Nafees' program development cycle methodologies and problem solving steps that include analysis, solution identification, algorithm preparation, program creation, execution, and maintenance.
E N D
Program • Program is a collection of instructions that will perform some task. Noornilo Nafees
Problem Solving Steps • Analyse the problem. • Identify the solution for the problem and divide it into small task. • Algorithm has to be prepared. • Based on the algorithm the program will be created. • Then it has to be executed. Noornilo Nafees
Program Development Cycle Methodologies • Program planning method • Waterfall method etc,. Noornilo Nafees
Program planning method Specification Review Informal Design Formal Design Coding Test & Debug Maintaining Noornilo Nafees
Specification review • collect the requirements • understand the requirements • Informal Design • Identifies the major tasks • Identifies the subtasks • Formal Design • It converts the informal design to some format that can be understand by others. Noornilo Nafees
Coding • It converts the Design into Programs. • It translate these programs to machine language. • Test &Debug • It use sample data to test whether it works properly. • It also eliminate the errors. Noornilo Nafees
Maintaining • It Modifies the programs if necessary. Noornilo Nafees
Waterfall method Feasibility Analysis Design Impl Testing Maintenance Noornilo Nafees
Feasibility • It determines whether it is possible to create the project or not. • It also produce the plans and the estimates. • Analysis • It get the requirements from the customer. • It analysis the requirements. Noornilo Nafees
Design • It is the process of designing how the requirements to be implemented. • Implementation • It converts the designs into code. • After coding it use language translators to compile the code. Noornilo Nafees
Testing • Here the modules are integrated together. • Then the project is tested and find whether it meets the customer/user requirements. • Maintenance • It make modifications based on the customer feedbacks. Noornilo Nafees
Algorithm • An algorithm is a well organized, pre arranged and defined textual computational module that receives some values or set of values as IP & provides a single or a set of values as OP. • It helps the programmer in breaking down the solution of a problem into a number of sequential steps. Noornilo Nafees
Characteristics • The steps in the algorithm must be unambiguous . • It should be written in sequence. • Ensure that the algorithm will terminate. • It should conclude after a finite number of steps. Noornilo Nafees
Factors used to judge the algorithm • Time • Memory • Accuracy • Sequence etc,. Noornilo Nafees
Example • Addition of two numbers Step1: Start Step2: Read a, b Step3: Add the value of a with b andstore the result in c. Step4: Display the value of c Step5: Stop Noornilo Nafees
Pseudocode • Pseudo means imitates andcode means instruction. • It is formal design tool. • It is also called Program Design Language. Noornilo Nafees
Keywords • READ,GET • PRINT,DISPLAY • COMPUTE,CALCULATE Noornilo Nafees
Guideline for writing Pseudocode • Steps should be understandable • Capitalize the keyword. • Indent to show hierarchy. • End multiple line structure etc,. Noornilo Nafees
Example READ a,b C=a+b WRITE C stop Noornilo Nafees
Example READ a,b IF a>b PRINT a is greater ELSE PRINT b is greater ENDIF stop Noornilo Nafees
Advantage & Disadvantage • It can be easily modified • It can be understood easily • Compare to flowchart it is difficult to understand the program logic. Noornilo Nafees
Flowcharts • It is the pictorial representation of the process. • It describes the sequence & flow of control & information in a process • It uses different symbols for depicting different activities Noornilo Nafees
Flowchart Symbols • Terminal symbol • It is used to represent the start, end of the program logic. • Input/Output • It is used for input or output. • Process Symbol • It is used to represent the calculations, data movements, initialization operations etc,. Noornilo Nafees
Decision Symbol • It is used to denote a decision to be made at that point • Flow lines • It is used to connect the symbols • Connectors • It is used to connect the flow lines. • Loop • It is used to denote loops involved in the process. Noornilo Nafees
Guidelines for preparing flowcharts • It should be clear and easy to follow • Standard symbols should be used. • The flow lines should not intersect each others. • In case of complex flowcharts use the connectors symbols. • Direction of flow of procedure is from left to right or top to bottom • It must have one logical start and end. Noornilo Nafees
Only one flow line should enter the process symbol and only one flow line should come out from a process symbol. • Only one flow line used with the terminal symbol. START STOP Noornilo Nafees
Only one flow line should enter the decision symbol and two or three flowlines may leave from the decision symbol. Noornilo Nafees
Benefits of Flowcharts • Makes Logic Clear • Communication • Effective Analysis • Proper Documentation • Efficient Coding • Proper Debugging • Efficient Program Maintenance Noornilo Nafees
Limits of Flowcharts • It is difficult to use flowcharts for large program • Difficult to modify • Cost etc,. Noornilo Nafees
Design Structures Sequence control structure Flow chart Pseudocode Process 1 Process 2 Process n Process 1 Process 2 Process n Noornilo Nafees
Sequence control structure The instructions are computed in sequence i.e. it performs instruction one after another. It uses top-down approach. Design Structures Noornilo Nafees
Example START Read a,b C=a+b Print c STOP Noornilo Nafees
SELECTION CONTROL STRUCTURE • It is used for making decisions. • It allows the program to make a choice from alternative paths. • IF …THEN • IF …THEN… ELSE • CASE etc., Noornilo Nafees
IF…THEN Pseudocode Flow chart IF condition THEN process 1 . .END IF . . If condition YES Process 1 NO Noornilo Nafees
Example Start Read a yes If a>0 no Print a is Positive Stop Noornilo Nafees
IF…THEN…ELSE Pseudocode Flowchart IF condition THEN process 1 . . ELSE process 2 . .END IF . . If condition YES NO Process 1 Process 2 Noornilo Nafees
Example Start Read a,b yes If a>b no Print a is Greater Print b is Greater Stop Noornilo Nafees
CASE structure Pseudocode Flow chart . . CASE Type Case Type-1: Process 1 Case Type-2: Process 2 . . Case Type-n: Process n . . END CASE Type 1 yes Process 1 no yes Type 2 Process 2 no Type 3 Process 3 yes no Noornilo Nafees
Example: Finding the Grade start Read m1,m2,m3 Avg=(m1+m2+m3)/3 If Avg>=60 Print First Class If Avg>=50 Print Second Class If Avg>=35 Print Third Class Fail Noornilo Nafees stop
Looping control structure • It is used to execute some instructions several time based on some condition. • WHILE loop • Do…WHILE loop etc., Noornilo Nafees
WHILE Loop Pseudocode Flow chart . . WHILE condition . . Body of the loop . . END WHILE condition no yes Body of The loop Noornilo Nafees
Example Start Num=0 while Num<5 no yes Num=Num+1 Print Num stop Noornilo Nafees
DO…WHILE Loop Pseudocode Flow chart DO . . Body of the loop . . WHILE condition . . END WHILE Body of The loop yes condition no Noornilo Nafees
Example Start Num=0 Num=Num+1 while Num<5 yes no Print Num stop Noornilo Nafees
Example: Finding the area of a circle Algorithm Step1: Start Step2: Read the value of r Step3: Calculate area Step4: Print area Step5: Stop Noornilo Nafees
Pseudocode Set area READ the r COMPUTE area=3.14*r*r PRINT area stop Noornilo Nafees
Flowchart START Read r area=3.14*r*r Print area STOP Noornilo Nafees
Find the largest among three Numbers Algorithm Step1: Start Step2: Read the value of a, b, c Step3: IF (a>b) and (a>c) THEN print a is largest ELSE IF (b>c) THEN print b is largest ELSE print c is largest Step4: Stop Noornilo Nafees
Pseudocode READ a, b, c IF (a>b) and (a>c) THEN WRITE a is largest ELSE IF (b>c) THEN WRITE b is largest ELSE WRITE c is largest ENDIF stop Noornilo Nafees
Flowchart START Read a,b,c If (a>b) and (a>c) yes Print a Is largest no yes If b>c Print b Is largest no Print c Is largest Noornilo Nafees stop