|
|
|
|
|
|
|
Get data
Test data
IF data OK
Calculate average
Print message indicating status
ELSE
Print Invalid Data: Score(s) less than zero. |
|
|
|
| |
|
|
|
|
Which of these steps require(s) expansion? Get data, Test data, and Print message indicating status all require multiple statements in order to solve their particular subproblem. On the other hand, we can translate Print Invalid Data: directly into a C++ output statement. What about the step Calculate average? We can write it as a single C++ statement, but there's another level of detail that we must inthe actual formula to be used. Because the formula is at a lower level of detail than the rest of the main module, we chose to expand Calculate average as a Level 1 module. |
|
|
|
|
|
|
|
|
|
Prompt for input
Read studentID, test1, test2, test3
Print studentID, test1, test2, test3 |
|
|
|
|
|
|
|
|
|
|
IF test1 < 0 OR test2 < 0 OR test3 < 0
Set dataOK = FALSE
ELSE
Set dataOK = TRUE/ |
|
|
|
|
|
|
|
|
|
|
|
Set average = (test1 + test2 + test3) / 3.0 |
|
|
|
|
|
|
|