Variable Name
ID: 3540442 • Letter: V
Question
I have a lot of points to give away!!!
You have been contracted by Green Forest Products to produce a basic data input, edit, calculate volumes, and display details for a Forest Inventory System. The C++ program should be modular (see the specified function table), contain no global variables, be clear and concise, have meaningful data names, and informative comments. Please read the directions carefully. Try to format the output so it looks good.
Brief Description of Application
Forest product organizations and other forestry related firms will often statistically sample their forests to determine estimates of current and future volumes. They do this by selecting a large number of relatively small plots of perhaps 1/10th of an acre. They then will measure all trees on each plot that are beyond a given size. In this particular example we have used 5.0 inches for dbh (diameter at breast height) and 24 feet for total height. Ordinarily one would include plot measurements as well as the individual tree data. I have attempted to keep this simple and we are only measuring the trees on a single plot and ignoring plot data.
Overview of Program Logic
Input is entered via the key board and consists of the following data for each sample tree:
Data Input Variables
treeNo
speciesCode
dbh
totalHt
Total Volume Calculation
Total volume of an individual tree is a function of dbh, species, and total height and has the following formula.
totalVol = b0 + b1 (dbh)2 ( totalHt)
b0 and b1 are regression coefficients for determining volume. Their values are determined by the two digit species code. To keep things simple, our C++ variables names for the coefficients are b0 and b1.
Tables
Location
Species[6]
speciesDes[6]
b 0[6]
b1[6]
0
11
Loblolly Pine
1.2446
.002165
1
12
White Pine
0.000
.002364
2
13
Red Pine
2.0822
.002046
3
21
White Oak
.7316
.001951
4
22
Red Oak
1.6378
.002032
5
23
Other Oak
.7554
.002174
Example of total volume calculation
Given: speciesCode = 13
dbh = 10.2
totalHt = 80
totalVol = 2.0822 + .002046 * 10.2 * 10.2 * 80 ;
totalVol = 19.111 cubic feet
Tree Data Constants and Calculated Results
treeNo
int
Tree number
speciesCode
int
Species code
speciesDesc[6]
string
Species description
dbh
float
Diameter breast height
totalHt
int.
Total height
totalVol
double
Total volume
Species[6]
int
Species code table
b0[6]
double
Regression coefficient
b1[6]
double
Regression coefficient
noTrees
int
Number of trees
avgTotVol
double
Average total volume
Function
Description
getTreeNo
Input tree number, input must be type int and > 0 and less than 200 or = 999. A value of 999 terminates input. Input is to be a do/while loop. Function is return by value.
getSpeciesCode
Species code is type int and must be valid and found in the species table. Input is a do/while loop. Function is return by value.
getDbh
Values are type float and must be greater than or equal to 5.0 and no greater than 50.6 inches. Input is a do/while loop. Function is return by value.
getTotHt
Values are type int and can range from 24 to 160. Total height is always measured as the closest even integer. For example, 131 would not be a valid measurement whereas 132 would be. Input is a do/while loop. Function is return by value.
calcTotVol
Calculate total volume (type float) using supplied formula. Output is 3 decimal places to the right of the decimal. Return by value function.
displayTreeData
The report specifications are described below. This is a void function.
Your report should look similar to the following. Feel free to make the format a little more attractive and even up the spacing. The report is to be displayed on the standard output device (cout) as well as stored on report.dat external data file.
Forest Inventory Detail Edit and Volume Calculation
Tree No. Species Description DBH Tot. Ht. Tot. Vol.
123 11 Loblolly Pine 5.8 120 9.984
124 12 White Pine 10.2 140 34.433
125 22 RedOak 15.6 142 71.858
Total trees measured = 3
Average total volume = 38.199
Notes on Volume Determination
Individual tree volumes are measured with different units. The formulas in this exercise are in cubic feet. Other common measurements are cords and cubic meters. Pulp wood is normally purchased by weight and saw logs by boardfeet. All of these can be converted from cubic feet. This exercise has taken several liberties as the real world is much more complicated than described here.
The following is a table of Tree Inventory Test Results:
treeNo
speciesCode
dbh
totalHt
Explanation / Answer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.