< previous page page_228 next page >

Page 228
Module Structure Chart:
0228-01.gif
Constants
NameValueDescription
BOARD_FT_INCHES144.0Cubic inches in 1 board foot
PLYWOOD_INCHES4608.0Cubic inches in 1 full sheet of plywood
WIDTH_INCHES48Width in inches of every sheet of plywood

In the following list of variables, notice that the data type listed for size1, size2, size3, and numOrdered is long (long integer) rather than int. In the calculation of the amount of wood ordered, the values of these variables are multiplied together. If the variables were of type int, their product could easily exceed the maximum int value, which is 32767 on many personal computers.
variables
NameData TypeDescription
codecharIndicates lumber or plywood item
size1longFirst dimension
size2longSecond dimension
size3longThird dimension
numOrderedlongNumber ordered
boardFeetfloatResult for lumber item
fullSheetsfloatResult for plywood item

To save space, from here on we omit the list of constants and variables from the Problem-Solving Case Studies. But we recommend that you continue writing those lists as you design your own algorithms. The lists save you a lot of work when you are writing the declarations for your programs. Here is the program that implements our design.

 
< previous page page_228 next page >