Software Development Cycle Overview - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Software Development Cycle Overview

Description:

A program is a well-defined computational procedure that solves a problem. ... to express the flow of control in a much more lucid fashion, flowcharts are used ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 29
Provided by: cengAna
Category:

less

Transcript and Presenter's Notes

Title: Software Development Cycle Overview


1
Todays Material
  • Software Development Cycle Overview
  • Analysis, Design, Implementation, Testing
  • Procedural Programming Basics
  • Pseudo-code
  • Flowcharts

2
Program
  • A program is a well-defined computational
    procedure that solves a problem. Example problems
    include
  • Compute the sum of N numbers
  • Find min/max of N numbers
  • Sort numbers
  • Compute average grade of a class

PROGRAM (Algorithm)
Input (Data)
Output (Results)
  • A program takes some values (data) as input,
    processes them and produces some results as output

3
Software Development Cycle
  • The software development cycle is the following
  • Specify problem requirements
  • Analyze the problem
  • Design a solution
  • Implement the algorithm
  • Test and verify
  • Maintain and update code
  • Todays subject is designing a solution, both
    literally and visually.
  • Pseudo codes
  • Flow Charts

4
Pseudo-code Flowcharts
  • The algorithms so far have been written in
    structural English
  • This algorithm style is called pseudo-code
  • Pseudo-code is usually a good way of beginning to
    design a solution
  • However, within a pseudo-code, the program flow
    is not always very clear
  • In order to express the flow of control in a much
    more lucid fashion, flowcharts are used

5
Flowcharts
  • A flowchart is a structured map showing the steps
    of the algorithm
  • The following shapes are used within a flowchart
    to express the flow of control

Parallelograms show input and output steps
Rectangles show processing steps
Diamonds indicate points of decision
End
Start
Arrows indicate flow of control
Circles are connectors
Start/End of the algorithm
6
Flowchart for Making a Sandwich
Start
Get bread, peanut butter, jelly, knife and plate
Place 2 slices of bread on the table
Spread butter on one slice
Spread jelly on the other slice
Slap two slices together, sticky side in
Eat the sandwich
End
7
Flowchart for Example2Conversion from
Fahrenheit-to-Celsius
Start
Prompt the user and get the fahrenheit
temperature to convert
celsius (fahrenheit-32)/1.8
Print the fahrenheit and celsius degrees
End
8
Flowchart for Example3Computing sum, product
and average
Start
Prompt the user and get number1 and number2
sum number1 number2
product number1 number2
average sum/2
Print sum, product and average
End
9
Flowchart for Example4 Computing circumference
and area of a circle
Start
Prompt the user and get radius of the circle
circumference 23.14radius
Area 3.14radiusradius
Print circumference and area of the circle
End
10
Flowchart for Example5Computing min and max of
2 numbers
Start
Prompt the user and get number1 and number2
number1 lt number2 ?
yes
no
min number1
min number2
max number2
max number1
Print min and max
End
11
Flowchart for Example6Computing min of 3 numbers
Start
Prompt the user and get number1, number2 and
number3
number1 lt number2 ?
yes
no
number2 lt number3 ?
number1 lt number3 ?
yes
yes
no
no
min number3
min number3
min number2
min number1
Print min
End
12
Flowchart for Example7Computing min of 3 numbers
Start
Prompt the user and get number1, number2 and
number3
min number1
yes
number2 lt min?
min number2
no
yes
number3 lt min?
min number3
no
Print min
End
13
Flowchart Example 8
  • A car starts to move, accelerates during 10
    minutes and its speed becomes 60 km/hr. Then, it
    continues with this speed during 15 minutes and
    finally slows down during 10 minutes and stops.
    What is the speed of the car at time T?

14
Speed Graph
15
Pseudo Code
  • Variables
  • T Time in minutes
  • V The speed at time T, in km/h
  • Algorithm
  • Step 1 Start
  • Step 2 Input T
  • Step 3 If T lt 10 go to Step 4, otherwise go to
    Step 5
  • Step 4 V 6T, go to Step 8
  • Step 5 If T lt 25 go to Step 6, otherwise go to
    Step 7
  • Step 6 V 60, go to Step 8
  • Step 7 V 210 6T
  • Step 8 Output V
  • Step 9 End

16
Flowchart
Start
Read T
Y
T lt 10 ?
V 6T
N
N
V 210 6T
T lt 25 ?
Y
V 60
Print V
End
17
Example 9
  • Determine whether a triangle is equilateral,
    isosceles, or multilateral when the lengths of
    its sides are given.
  • Inputs
  • A Length of the first side
  • B Length of the second side
  • C Length of the third side
  • Output
  • The type of the triangle

18
Algorithm
  • Step 1 Start
  • Step 2 Input A, B, and C values
  • Step 3 If A B go to step 4, otherwise go to
    Step 5
  • Step 4 If A C go to step 7, otherwise go to
    Step 8
  • Step 5 If A C go to step 8, otherwise go to
    step 6
  • Step 6 If B C go to Step 8, otherwise go to
    Step 9
  • Step 7 Print Equilateral and go to Step 10
  • Step 8 Print Isosceles and go to Step 10
  • Step 9 Print Multilateral and go to Step 10
  • Step 10 End

19
Start
Read A, B, C
A B ?
A C ?
A C ?
B C ?
Y
N
N
N
Y
Y
Y
N
Equilateral
Isosceles
Multilateral
End
20
Example 10
  • Calculate the real roots of the second order
    equation Ax2 Bx C 0.
  • Inputs
  • A Coefficient of x2
  • B Coefficient of x
  • C Constant term
  • Outputs
  • X1 First root of the equation
  • X2 Second root of the equation
  • Temporary Variables
  • ? sqrt(B2 4AC)

21
Algorithm
  • Step 1 Start
  • Step 2 Input A, B and C
  • Step 3 Calculate ? B2 4AC
  • Step 4 If ? lt 0 go to Step 6, otherwise go to
    Step 5
  • Step 5 If ? gt 0 go to Step 7, otherwise go to
    Step 8
  • Step 6 Output Complex Roots. Go to step 13
  • Step 7 Output Two Real Roots. Go to step 9
  • Step 8 Output Equal Roots. Go to step 9
  • Step 9 Calculate X1 (-b sqrt(?))/(2A)
  • Step 10 Calculate X2(-b - sqrt(?))/(2A)
  • Step 11 Output X1
  • Step 12 Output X2
  • Step 13 End

22
Start
Read A, B, C
? B2 4AC
N
Y
? lt 0 ?
Complex Roots
? gt 0 ?
N
Y
Equal Roots
Two Real Roots
X1 (-bv?)/(2A) X2 (-b-v?)/(2A)
Output X1 and X2
End
23
Example 11
  • In a classroom of 10 students the ages of the
    students varies between 18 and 20. Calculate the
    number of students at the ages 18, 19, and 20.
  • Inputs
  • Ages of the 10 students
  • Outputs
  • S18 Number of 18 year old students
  • S19 Number of 19 year old students
  • S20 Number of 20 year old students
  • Temporary Variables
  • X Student counter
  • A Age of a student

24
Algorithm
  • Step 1 Start
  • Step 2 Initialize S18, S19, S20, and X to 0.
  • Step 3 If X 10 go to step 13 otherwise
    continue
  • Step 4 Input a student age, A
  • Step 5 If A 18 go to step 9
  • Step 6 If A 19 go to step 10
  • Step 7 If A 20 go to step 11
  • Step 8 Output age error and go to step 4
  • Step 9 Calculate S18 S18 1, go to step 12
  • Step 10 Calculate S19 S19 1, go to step 12
  • Step 11 Calculate S20 S20 1
  • Step 12 X X 1, and go to step 3
  • Step 13 Output S18, S19 and S20
  • Step 14 End

25
Start
S18 S19 S20 X 0
Output S18, S19, and S20
X 10 ?
Y
N
Input A
End
A 18 ?
Y
S18 S18 1
N
A 19 ?
Y
S19 S19 1
X X 1
N
A 20 ?
Age Error
Y
N
S20 S20 1
26
Example 12
  • Calculate the factorial of N.
  • Input
  • N The number whose factorial to be calculated
  • Output
  • F Factorial of N
  • Temporary Variable
  • Counter Numbers from 1 to N

27
Algorithm
  • Step 1 Start
  • Step 2 Input N
  • Step 3 Initialize Counter and F to 1
  • Step 4 If Counter gt N go to Step 7
  • Step 5 Calculate F F Counter
  • Step 6 Increment Counter and go to Step 4
  • Step 7 Output F
  • Step 8 End

28
Start
Input N
Counter 1 F 1
Counter gt N ?
F F Counter
N
Y
Counter Counter 1
Output F
End
Write a Comment
User Comments (0)
About PowerShow.com