|
|
|
| Constants | | Name | Value | Description | | BOARD_FT_INCHES | 144.0 | Cubic inches in 1 board foot | | PLYWOOD_INCHES | 4608.0 | Cubic inches in 1 full sheet of plywood | | WIDTH_INCHES | 48 | Width 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 | | Name | Data Type | Description | | code | char | Indicates lumber or plywood item | | size1 | long | First dimension | | size2 | long | Second dimension | | size3 | long | Third dimension | | numOrdered | long | Number ordered | | boardFeet | float | Result for lumber item | | fullSheets | float | Result 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. |
|
|
|
|
|