Project: Tree Growth

Trees and Growth Patterns

Trees provide a number of benefits for the environment. Trees are able to absorb dangerous gases such as carbon dioxide (CO2) while, at the same time, producing oxygen for us to breathe. Trees also absorb and distribute water that otherwise may lead to runoff, thus reducing pollution and loss of topsoil. Some forms of trees even produce food for us to eat (think: apple trees). Watch the following animated video to learn more about the benefits of trees to our society:

As we plant trees strategically, we often want to know how tall a tree can be expected to grow. While there are environmental factors that impact tree growth patterns, we can approximate the height of tree if we know certain facts.  As trees grow, they add approximately the same amount of mass each year. If we know this amount, we can compute the expected height of a tree over time. The height of a tree (h) can be approximated based on its age using the following formula:

Tree_Growth_Equation

where a = the amount of mass added to a tree each year and t is the age in years.

Tree02

 

C++ Project: Computing Tree Growth

This project will provide you with an introduction to the fundamentals of problem-solving in C++. The focus of this project is on how to solve simple problems using C++ data types, variables, and arithmetic operations. In this project, you will…

  • Develop code to read data from the standard input and produce data to the standard output.
  • Translate a given mathematical expression into equivalent syntactically correct programming statements.
  • Write code that conforms to a programming style specified by the instructor.

Create a program called TreeGrowth.cpp to compute the approximate height of a tree based on the amount of mass added each year (a double value) and the age in years (an int value). All real numeric amounts should be precise to two decimal places. Here are few sample tests you can run to check if your program is working correctly:

Test Case #1

Enter the Amount of Mass: 256.0
Enter the Age in Years: 81

You entered a mass of 256.00 and an age of 81 years.
The approximate height of the tree is 12.00 meters.

Test Case #2

Enter the Amount of Mass: 5333.3333
Enter the Age in Years: 30

You entered a mass of 5333.33 and an age of 30 years.
The approximate height of the tree is 20.00 meters.

Deliverables

See the instructor for submission instructions and due date(s).

Powered by WordPress. Designed by WooThemes

Skip to toolbar