Download presentation
Presentation is loading. Please wait.
Published byEthan Rodgers Modified over 9 years ago
1
Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman
2
Software Development Method 1. Specify the problem requirements 2. Analyze the problem 3. Design the algorithm to solve the problem 4. Implement the algorithm 5. Test and verify the completed program 6. Maintain and update the program
3
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.
4
Analysis Analyzing the problem involves identifying the problem inputs,that is,the data you have to work with outputs,that is,the desired results any additional requirements or constraints on the solution
5
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
6
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.
7
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 :
8
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)
9
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
10
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
11
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
12
Design Algorithm for a Programming Problem 1. Get the data 2. Perform the computations 3. Display the results Algorithm can be presented either using pseudocode or flowchart.
13
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.
14
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.
15
Case Study 1
16
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.
17
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.60 Bandaraya= RM 1.40 PWTC= RM 2.20
18
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)
19
Implementation Program…..
20
Testing Test the program by inserting different number of passenger and locations.
21
Case Study 2
22
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.
23
Analysis The problem states that you prefer to deal in metric measurements, so you must convert distance measurements in miles to kilometers Problem Input miles# the distance in miles Problem Output kms# the distance in kilometers Relevant Formula 1 mile = 1.609 kilometers
24
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
25
Implementation # Converts distance in miles to kilometers # Conversion constant KMS_PER_MILE = 1.609 # Input distance in miles miles = 0 # Output distance in kilometers kms = 0 # Get the distance in miles print "Enter the distance in miles", miles = input(":") # Convert the distance to kilometers kms = KMS_PER_MILE * miles # Display the distance in kilometers print "That equals ", kms
26
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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.