In C++ use Functions with Pointers and References   Your free fall calculator program will calculate the time it takes an object to fall until it hits the ground.   This program requires functions. Place the function prototypes in a file named FallFunctions.h. Create a global constant for ACCELERATION in the .h file, too. Use a comment to define the units for acceleration. Place the associated function implementations in FallFunctions.cpp. Call all functions from main, which is located in your Driver.cpp.   In main, you will call the Header function first. Then, start a do another loop. Inside the loop, call the AskHeight function using a reference to height to ask the user for the height of the fall in feet. Next, call the TimeToFall function using a pointer to time to calculate the time it takes the object to fall. Pass time and height to the WriteResults function to write the information in a neatly formatted string. The string is then returned to main and written to the screen.   Make sure to ask the user to input values in correct units. See table below for functions to write, formulas and units.   Prototype Content void DisplayHeader () Write your program header void AskHeight(double &height) Ask the user for the height of the fall void TimeToFall(double *time, double height); Calculate the time to fall using the formula: Where: time = time to fall in seconds. height = distance to fall in feet. acceleration = 32.2 (acceleration due to gravity in feet/second2).   In C++, the square root function could be used like this: time = sqrt( 2 * height / acceleration ) string WriteResults(double time, double height) Writes height of fall and time to fall in a neatly formatted string

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ Programming I: Free Fall Calc

In C++ use Functions with Pointers and References

 

Your free fall calculator program will calculate the time it takes an object to fall until it hits the ground.

 

This program requires functions. Place the function prototypes in a file named FallFunctions.h. Create a global constant for ACCELERATION in the .h file, too. Use a comment to define the units for acceleration. Place the associated function implementations in FallFunctions.cpp. Call all functions from main, which is located in your Driver.cpp.

 

In main, you will call the Header function first. Then, start a do another loop. Inside the loop, call the AskHeight function using a reference to height to ask the user for the height of the fall in feet. Next, call the TimeToFall function using a pointer to time to calculate the time it takes the object to fall. Pass time and height to the WriteResults function to write the information in a neatly formatted string. The string is then returned to main and written to the screen.

 

Make sure to ask the user to input values in correct units. See table below for functions to write, formulas and units.

 

Prototype

Content

void DisplayHeader ()

Write your program header

void AskHeight(double &height)

Ask the user for the height of the fall

void TimeToFall(double *time, double height);

Calculate the time to fall using the formula:

Where:

time = time to fall in seconds.

height = distance to fall in feet.

acceleration = 32.2 (acceleration due to gravity in feet/second2).

 

In C++, the square root function could be used like this:

time = sqrt( 2 * height / acceleration )

string WriteResults(double time, double height)

Writes height of fall and time to fall in a neatly formatted string

 

Give your user the opportunity to do more calculations, and then when they are finished, write a Good-Bye message.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education