February 2014
Beginner
1248 pages
62h 25m
English
The preceding Software Engineering Observation is often all you need for the first refinement in the top-down process. To proceed to the next level of refinement—that is, the second refinement—we commit to specific variables. In this example, we need a running total of the numbers, a count of how many numbers have been processed, a variable to receive the value of each grade as it’s input by the user and a variable to hold the calculated average. The pseudocode statement
Initialize variables
can be refined as follows:
Initialize total to zeroInitialize counter to zero
Only the variables total and counter need to be initialized before they’re used. The variables average and grade (for the calculated average ...
Read now
Unlock full access