< previous page page_227 next page >

Page 227
number of pieces to get the volume in cubic inches. You would divide this quantity by the volume of one full sheet (4608 cubic inches) to get the number of sheets.
The process can be translated directly into a program. Read the letter and four numbers becomes an input statement. We use an If-Then-Else statement to examine the letter and decide which formula to use. Each branch of the If-Then-Else has two steps. In the first, we calculate the appropriate result. In the second, we print the result and say whether it is in board feet or full sheets.
Main Module Level 0
Get data
IF code equals 'L'
Calculate lumber amount
ELSE
Calculate plywood amount

Get Data Level 1
Prompt for input
Read code, size1, size2, size3, numOrdered
Echo-print input data

Calculate Lumber Amount
Set boardFeet = size1 * size2 * size3 * 12 *
numOrdered / BOARD_FT_INCHES
Print boardFeet

Calculate Plywood Amount
Set fullSheets = size1 / size2 * size3 * 12 * WIDTH_INCHES *
numOrdered / PLYWOOD_INCHES
Print fullSheets

 
< previous page page_227 next page >