Professional Documents
Culture Documents
Program
Program is a collection of instructions that will perform some task.
Informal Design
Formal Design
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.
Coding
It converts the Design into Programs. It translate these programs to machine language.
Maintaining
It Modifies the programs if necessary.
Waterfall method
Feasibility Analysis
Design
Impl
Testing
Maintenance
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.
Implementation
It converts the designs into code. After coding it use language translators to compile the code.
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.
Algorithm
Algorithm is a finite sequence of instructions required for producing the desired result.
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.
Representations
Flowcharts Normal English Pseudo code etc,.
Example
Addition of two numbers Step1: Start Step2: Read a, b Step3: Add the value of a with b and store the result in c. Step4: Display the value of c Step5: Stop
Flowcharts
It is the pictorial representation of the algorithm.
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,.
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.
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 should enter the decision symbol and two or three flowlines may leave from the decision symbol.
Benefits of Flowcharts
Makes Logic Clear Communication Effective Analysis Useful in coding Useful in Testing etc,.
Limits of Flowcharts
It is difficult to use flowcharts for large program Difficult to modify Cost etc,.
Pseudocode
Pseudo means imitates and code means instruction. It is formal design tool. It is also called Program Design Language.
Keywords
READ,GET PRINT,DISPLAY COMPUTE,CALCULATE
Example
READ a,b C=a+b WRITE C stop
Example
READ a,b IF a>b PRINT a is greater ELSE PRINT b is greater ENDIF stop
Design Structures
Sequence control structure
Flow chart
Process 1
Process 2
Pseudocode
Process 1 Process 2
Process n
Process n
Design Structures
Sequence control structure
The instructions are computed in sequence i.e. it performs instruction one after another. It uses top-down approach.
Example
START
Read a,b
C=a+b Print c STOP
IFTHEN
Pseudocode Flow chart
IF condition THEN process 1 YES . . Process 1 END IF . .
If condition NO
Example
Start
Read a
yes
If a>0
Print a is Positive no
Stop
IFTHENELSE
Pseudocode Flowchart
YES
If condition
NO
Process 1
Process 2
Example
Start
Read a,b
yes
If a>b
Print a is Greater no Print b is Greater
Stop
CASE structure
Pseudocode . . CASE Type Case Type-1: Process 1 Case Type-2: Process 2 . . Case Type-n: Process n . . END CASE Flow chart Type 1
no
yes
Process 1
Type 2
no
yes
Process 2
Type 3
no
yes
Process 3
Avg=(m1+m2+m3)/3
If Avg>=60
If Avg>=50 If Avg>=35
Print
Third Class
Fail
stop
WHILE Loop
Pseudocode
.
Flow chart
condition
yes Body of The loop
no
Example
Start Num=0
while no
Num<5
yes
Num=Num+1
Print Num
stop
DOWHILE Loop
Pseudocode
DO
. . Body of the loop . . WHILE condition
. Body of The loop yes
Flow chart
condition
no
.
END WHILE
Example
Start Num=0
Num=Num+1
yes
stop
Pseudocode
Set area READ the r COMPUTE area=3.14*r*r PRINT area stop
Flowchart
START
Read r
area=3.14*r*r Print area STOP
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
Flowchart
START Read a,b,c If (a>b) and (a>c)
no yes
Print a Is largest
If b>c
no
yes
Print b Is largest
Print c Is largest
stop
Pseudocode
Set root1,root2 READ the value of a, b, c Find D b*b-4*a*c IF D>=0 THEN calculate root1=(-b+sqrt(D))/(2*a) root2=(-b-sqrt(D))/(2*a) ELSE Roots are imaginary END IF WRITE root1,root2 Stop
Flow chart
Start Read a,b,c D=b*b-4*a*c
no
If D>=0
yes
Root1=[-b+sqrt(D)]/(2*a) Root2=[-b+sqrt(D)]/(2*a)
Print root1,root2
Stop
Pseudocode
READ the value of a, b To swap use c=a a=b b=c WRITE a, b stop
Flowchart
START Read a, b c=a a=b b=c Print a, b STOP
Pseudocode
READ the value of a, b To swap use a=a+b b=a-b a=a-b WRITE a, b stop
Flowchart
START Read a, b a=a+b b=a-b a=a-b Print a, b STOP
Pseudocode
READ year IF year % 4 ==0 THEN WRITE It is a Leap year ELSE WRITE It is not a Leap year ENDIF stop
Flowchart
Start
Read year
yes
year % 4 ==0
Print It is a Leap year no Print It is not a Leap year
Stop
Pseudocode
READ the value of n and set i =1 WHILE (i <= n) do fact =fact * i i=i+1 ENDWHILE Repeat the loop until condition fails WRITE fact stop
Flowchart
i<=n
yes
fact=fact * i i=i+1
Print fact
stop
Pseudocode
READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum + r n=n/10 ENDWHILE Repeat the loop until condition fails WRITE sum stop
Flowchart
Start
Read n
r = 0,sum=0
while no
n>0
yes
stop
Pseudocode
READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum *10 + r n=n/10 ENDWHILE Repeat the loop until condition fails WRITE sum stop
Flowchart
Start
Read n
r = 0,sum=0
while no
n>0
yes
stop
Armstrong Number
Example: 153 13 +53 + 33 =153
Pseudocode
READ the value of n and set a =n, sum=0 WHILE (n>0) do r=n%10 sum=sum + r*r*r n=n/10 ENDWHILE Repeat the loop until condition fails IF a=sum THEN WRITE Armstrong Number ELSE WRITE It is not an Armstrong Number ENDIF stop
Flowchart
Start
Read n a = n,sum=0
while
yes
n>0
no
a=sum
Print It is Not an Print Armstrong No
Armstrong No
stop
Fibonacci series
Example:
0 1 1 2 3 5 8 11.
Pseudocode
READ the value of n and set f=0 ,f1=-1, f2=1 WHILE (f<n) do f=f1+f2 f1=f2 f2=f WRITE f ENDWHILE Repeat the loop until condition fails stop
Flowchart
Start
Read n
f=0,f1= -1,f2=1
while yes no
stop
Pseudocode
Set Fahrenheit READ the Celsius COMPUTE Fahrenheit = (1.8* Celsius) + 32 PRINT Fahrenheit stop
Flowchart
START
Read Celsius
Fahrenheit = (1.8* Celsius) + 32 Print Fahrenheit STOP
Pseudocode
Set Celsius READ the Fahrenheit COMPUTE Celsius =(Fahrenheit 32)/1.8 PRINT Celsius stop
Flowchart
START
Read Fahrenheit
Celsius =(Fahrenheit 32)/1.8 Print Celsius STOP
Pseudocode
READ the value of n and set sum=0,i=1 WHILE (i<=n) do sum=sum+i i=i+2 ENDWHILE Repeat the loop until condition fails WRITE sum stop
Flowchart
Start
Read n
sum=0,i=1
While i<=n
sum=sum+i i=i+2
Print sum
stop
Pseudocode
READ the value of n and set sum=0,i=0 WHILE (i<=n) do sum=sum+i i=i+2 ENDWHILE Repeat the loop until condition fails WRITE sum stop
Flowchart
Start
Read n
sum=0,i=0
While i<=n sum=sum+i i=i+2
Print sum
stop
Pseudocode
READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum + r*pow(2,i) n=n/10 i=i+1 ENDWHILE Repeat the loop until condition fails WRITE sum stop
Flowchart
Start
Read n
sum=0,i=0
While n>0 r=n%10 sum=sum + r*Pow(2,i) n=n/10 i=i+1
Print sum
stop
Application software
Set of programs, which is used to perform some specific task. Example:
Word processor Spreadsheet program Database program etc,.
MS-Word
Starting MS-Word Start All Programs Microsoft Office Microsoft Office Word
Creating a New Document File New (or) ctrl+N (or) clicking the new button
Opening a Document File Open (or) ctrl+O (or) clicking the open button
Saving a New Document File Save (or) ctrl+S (or) clicking the save button
Printing a Document File Print (or) ctrl+P (or) clicking the open button