Complete Second Refinement of Pseudocode and Conversion to Class Analysis

The complete second refinement appears in Fig. 4.11. Notice that blank lines are also used to set off the While structure for program readability. This pseudocode is now sufficiently refined for conversion to Java.

 1   Initialize passes to zero  2   Initialize failures to zero  3   Initialize student counter to one  4  5   While student counter is less than or equal to 10  6      Prompt the user to enter the next exam result  7      Input the next exam result  8  9      If the student passed 10         Add one to passes 11      Else 12         Add one to failures 13 14      Add one to student counter 15 16   Print the number of passes

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.