CheckPoint: Chapter 2 Programming Problem
|
Appendix E IT/210 Version 5 |
1 |
Associate Program Material
Appendix E
System-Level Requirements Example
Consider the Input and Output Process Example program in Appendix B, in which you developed what are often called system-level requirements: the basis for all subsequent analysis and design steps. The following steps will take these system-level requirements and refine them into a detailed blueprint for the program.
Up to this point, you have identified the processes the program must perform, but you have not given any consideration to exactly how the processes work together to solve the problem. At this point, you must generate a description of the processing using pseudocode, a natural language description of the processing the application must perform.
The natural place to start is the system-level requirements you identified in the input-process-output (IPO) chart. Determine how the processes work together: Once you have determined the top-level logic, you can design each individual process. This step-wise refinement process allows you to conceptualize a vague problem into increasing levels of details to actually generate a working program. This point is important because the step-wise refinement process is used throughout the entire program development—each new piece of information is based on, and is a refinement of, the information uncovered in the previous step.
For this week’s CheckPoint, you will refine the IPO table into a complete design, as demonstrated on pp. 80 & 83 in Ch. 2 of Prelude to Programming. Additionally, refer also to the Input and Output Process Example in Appendix B to see how more detailed analysis and design relates to the previously constructed IPO chart.
The following information demonstrates all the items you need to develop your programming assignments and the final project.
Analysis
Process:
1. Get user input.
2. Find the room area.
3. Divide the room area.
4. Multiply gallons.
5. Prompt for ounces.
6. Display total.
price (real: 0-100)
squareFeetPerGal (real: 0-1000)
width (real: 0-100)
length (real: 0-100)
height (real: 0-100)
Input:
Output:
total_cost (real: > 0)
Design
Main Module
Declare price as real
Declare squareFeetPerGal as real
Declare width as real
Declare length as real
Declare height as real
Declare totalArea as real
Declare gallonsNeeded as real
Declare outputPrompt as string
Declare totalCost as real
Get user input
Find the room area
Divide the room area
Multiply gallons
Display total
End Main Module
Input Data Module
Write, “What is the price per gallon of paint?”
Input price
Write, “How many square feet does each gallon cover?”
Input square_feet_per_gal
Write, “What is the height of the walls?”
Input height
Write, “What is the width of the walls?”
Input width
Write, “What is the length of the walls?”
Input length
End Input Data Module
Find Room Area Module
Declare sideArea as real.
Declare frontBackArea as real.
Declare ceilingArea as real.
sideArea = 2*(length * height)
frontBackArea = 2*(width * height)
ceilingArea = width * length
totalArea = sideArea + frontBackArea + ceilingArea
End Find Room Area Module