Question: Create a C++ program, suing C++ only, please make the code simple and at where they needed.(Please follow the requirements). use the required test runs,
Create a C++ program, suing C++ only, please make the code simple and at where they needed.(Please follow the requirements).
use the required test runs, Variable declarations at the top of main, No while loop at the WelcomeAndMenu, Years is unsigned int in this program.



A problem in timber management is to determine how much of an area to leave uncut so that the harvested area is reforested in a certain period of time. Given that reforestation takes place at a known rate per year (depending on climate and soil conditions) one can make a few helpful estimates. Your job including writing two timber regrowth functions plus a welcome/menu function and an output function. These will go with a main() function (and other functions if/as needed) that will test them Reforestation Model A reforestation equation expresses annual regrowth as a function of the amount of timber standing and the reforestation rate NewAcres PreviousAcres +ReforestationRate*PreviousAcres For example, if 100 acres are standing after harvesting and the reforestation rate is 0.05, then 100 + 0.05 * 100 = 105 acres are forested at the end of the first year, at the end of the second year it is 105 + 0.05105 or 110.25 acres. If you repeat this for nyears, you can find the total reforested area after a given period of time. For this program we will be using type double for acreage and reforestation rate variables and type unsigned int for years. Required Functions: IMPORTANTto receive credit for this assignment, your program must not only find the correct answer but must include at least these functions, along with main(). Programs without these functions will not be graded WelcomeAndMenuWelcome the user. Show them the menu of options 1) Reforestation Table 2) Determine Years to Reforest 3) Quit Accept their choice. You can decide if you want them to enter a char or an int for their choice. Return this choice to main() ReforestTable this function accepts the area left uncut (which is the initial value for "PreviousAcres"), the reforestation rate, and the number of years (an unsigned int) as parameters. (These values are input in main()). It outputs a table showing the number of acres forested at the end of each year, from year 0 (the starting point) through the given number of years. For example Year Forested Acres 100.00 105.00 110.25 and so on. Note that year 0 is the initial uncut area AND the starting point for the table. YOU MUST USE A for-LOOP TO CREATE THIS TABLE. You may choose the digits-of-precision to be 1, 2 or 3 digits, but this must be consistent. Lining the table up counts to. The function returns no value to the caller YearsToRefo rest target area to be reforested. (For example, 2500 acres left standing, a rate of 0.02 and a target of 14,000 acres eventually forested.) It then determines and returns to the caller the number of years (an unsigned int) it will take for the given area to be completely reforested. YOU MUST USE A while LOOP FOR THIS CALCULATION. Looping stops when the number of acres reforested either equals or exceeds the target. (Note: In its final version, this function has no cout statements.) OutputYears this function is used AFTER YearsToReforest has done its job. It accepts the number of years it wlltake for the area to be completely reforested as an unsigned int parameter and outputs this value with an appropriate message this function accepts the area left uncut, the reforestation rate, and a . . Testing the Function Here is the basic outline of the main() function (which mostly calls functions and accepts a little input) Call WelcomeAndMenu() . While they have not chosen to quit . Use a switch statement to determine what happens next: If the user selects 1), request the area left uncut, reforestation rate and number of years, then call ReforestTable(). The values just input will be the arguments sent to the parameters of ReforestTable. To make data-entry code simpler, we will NOT do any data validation (even though we should). That is, we will assume users will (correctly) enter numbers that are >0 for each of these. (Using an unsigned int for the number of years handles this for length of time.) If the user selects 2), request the area left uncut, the reforestation rate and the target area to be reforested. The only input validation here is that the target area must be >the area originally left uncut. If this is NOT the case, allow the user to keep entering values until they get it right. USE A do-while LOOP. (Once you do this, the extra credit in the previous bullet might should be fairly easy to get .) Then call YearsToReforest(). After this function returns the years, call OutputYears() o o When they select 3), thank them and quit. o If they type in any other value for their choice, output an error message (but DON'T quit) Unless they chose to quit call WelcomeAndMenu() . ALL data must be passed by using arguments and parameters or through return statements GLOBAL VARIABLES WILL LEAD TO SEVERE POINT LOSS. Note: while you do NOT need to include analysis/design with this program because I've given you the outline, it wouldn't hurt to make a few notes before you begin (hint, hint) Style in the selection of identifier names, layout and so on count. . Hand-in: Your main.cpp You may test your program with multiple forestation scenarios, but I need to see the following run (and, yes, this should require only 1 run of the program) Uncut 100 100 2500 Rate 0.05 0.05 0.02 Menu Selection Years 20 TargetArea 250 1400 (retry) 14000 (Error: should not ask for any more data) (Thank the user and quit) 4 Submit a screen shot showing this run. (Those of you using the little tiny XCode output screen may want to/ need to enlarge this or rearrange the interface a bit or you won't be able to see the whole of a single run's output.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
