+ All Categories
Home > Documents > Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot...

Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot...

Date post: 04-Jan-2016
Category:
Upload: ethan-rodgers
View: 239 times
Download: 1 times
Share this document with a friend
Popular Tags:
26
Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman
Transcript
Page 1: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Software Development Method

Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman

Page 2: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Software Development Method

1. Specify the problem requirements2. Analyze the problem3. Design the algorithm to solve the

problem4. Implement the algorithm5. Test and verify the completed program6. Maintain and update the program

Page 3: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Problem

Specifying the problems requirement forces you to state the problem clearly and unambiguously and to gain a clear understanding of what is required for its solution.

Objective – To eliminate unimportant aspects and zero in on the root problem.

Page 4: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

Analyzing the problem involves identifying the problem inputs,that is,the data you have to work withoutputs,that is,the desired resultsany additional requirements or constraints on

the solution

Page 5: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

At this stage, you should also determine the required format in which the results should be displayed

Develop a list of problem variables and relationships

These relationships may be expressed as formulas

Page 6: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

If steps 1 and 2 are not done properly,you will solve the wrong problem.

Read the problem statements carefully ,first,to obtain a clear idea of the problem

And second, to determine the inputs and outputs.You may find it helpful to underline phrases in the problem statement that identify the inputs and outputs,as in the problem statement below.

Page 7: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

Compute and display the total cost of apples given the number of pounds of apples purchased and the cost per pound of apples.

Next,summarize the information contained in the underlined phrases :

Page 8: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

Problem Input

quantity of apples purchased (in pounds)

cost per pound of apples (in dollars per pound)

Problem Output

total cost of apples (in dollars)

Page 9: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

Once you know the problem inputs and outputs, develop a list of formulas that specify relationships between them.The general formula

Total cost=Unit cost X Number of units

Page 10: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis

computes the total cost of any item purchased.Substituting the variables for our particular problem yields the formula

Total cost of apples =

Cost per pound X Pounds of apples

Page 11: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Design

Designing the algorithm to solve the problem requires you to develop a list of steps called an algorithm to solve the problem and then verify that the algorithm solves the problem as intended.

algorithm = a list of steps for solving a problem

Page 12: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Design

Algorithm for a Programming Problem1. Get the data

2. Perform the computations

3. Display the results Algorithm can be presented either using

pseudocode or flowchart.

Page 13: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Implementation

Implementing the algorithm involves writing it as a program.

You must convert each algorithm step into one or more statements in a programming language.

Page 14: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Testing

Testing and verifying the program requires testing the completed program to verify that it works as desired.

Run the program several times using different sets of data,making sure that it works correctly for every situation provided for in the algorithm.

Page 15: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Case Study 1

Page 16: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Problem

You and your three friends plan to go for shopping around KL. There are 3 ways to go there. Your options are between LRT, taxi or bus. Due to heavy traffic congestion, you and your friends decided to choose transport which is fast but convenient. Write a program to calculate the chosen transport fare.

Page 17: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis Choose LRT - Why ? It save time and cost Problem Input - Number of passenger and LRT fare Problem Output - LRT fare according to number of

passenger and destination Relevant Formula =

LRT fare X number of passenger Relevant data –

LRT fare to :Bukit Bintang = RM 1.60Bandaraya = RM 1.40PWTC = RM 2.20

Page 18: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Design

1. Get number of passenger and destination.

2. Calculate the LRT fare by performing below computation :

LRT fare X number of passenger

3. Display LRT fare in Ringgit Malaysia(RM)

Page 19: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Implementation

Program…..

Page 20: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Testing

Test the program by inserting different number of passenger and locations.

Page 21: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Case Study 2

Page 22: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Problem

Your summer surveying job requires you to study some maps that gives distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion.

Page 23: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Analysis The problem states that you prefer to deal in metric

measurements, so you must convert distance measurements in miles to kilometers Problem Inputmiles # the distance in miles

Problem Outputkms # the distance in kilometers

Relevant Formula1 mile = 1.609 kilometers

Page 24: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Design

1. Get the distance in miles.

2. Convert the distance to kilometers. The distance in kilometers is 1.609 times the

distance in miles.

3. Display the distance in kilometers

Page 25: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Implementation# Converts distance in miles to kilometers # Conversion constantKMS_PER_MILE = 1.609 # Input distance in milesmiles = 0 # Output distance in kilometerskms = 0 # Get the distance in milesprint "Enter the distance in miles",miles = input(":") # Convert the distance to kilometerskms = KMS_PER_MILE * miles # Display the distance in kilometersprint "That equals ", kms

Page 26: Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.

Testing

Distance of 10.0 miles is converted to 16.09 kilometers, as it should be. Test the program by inserting other different value of distance.


Recommended