Question: HDQUZ, please do not answer my tutor question. thank you. // Passing arguments by-Value and using return types. #include using namespace std ; // Constant
HDQUZ, please do not answer my tutor question. thank you.
// Passing arguments by-Value and using return types.
#include
using namespace std;
// Constant factor for gravitational acceleration
const double GRAVITATION_CONSTANT = 9.8; // meters/sec^2
// TODO: Declare 3 function prototypes
// - Name: getFallingTime.
// Parameters:
// Returns: a double for the amount of time an object falls (to be entered by the user).
// - Name: fallingDistance.
// Parameters:
// - 1 double for time in seconds (pass by value)
// Returns: a double for the number of meters the object falls
// - Name: displayResults
// Parameters:
// - 1 double for time (in seconds - pass by value)
// - 1 double for distance (in meters - pass by value)
// Returns:
// ********************************************
int main()
{
// Declare program variables.
double timeInSeconds, distanceInMeters;
// TODO: Call function to get the amount of time the object falls.
// A double value is returned - assign to the correct variable
// TODO: Call function to calculate the distance the object falls,
// given the seconds that it falls
// Pass one argument representing the amount of time the object falls.
// Assign the returned value to the correct variable
// TODO: Call function to print the results.
// Pass the correct two arguments to the function
// Nothing is returned, so do NOT provide a variable assignment
cout << "End program - ";
return 0;
}
// ********************************************
// TODO: Define getFallingTime()
// Refer to the function prototype above for parameter and return type info
//
// Repeat
// - Prompt the user to enter the seconds the object falls
// - Read the user's keyboard response
// Until a value more than 0 is entered
// ********************************************
// TODO: Define fallingDistance()
// Refer to the function prototype above for parameter and return type info
//
// The formula for the distance an object falls due to gravity is:
// d = 1/2 gt^2 (^2 means squared)
// where:
//d = the distance the object falls (in meters)
// g = the gravitational acceleration constant (in meters per second squared)
// t = the amount of time the object falls (in seconds)
// ********************************************
// TODO: Define displayResults()
// Refer to the function prototype above for parameter and return type info
// Output statement to format results as shown in Sample Output
// using values passed to parameters.
/* Sample Output
Sample Run #1:
=====================
Enter seconds the object falls: 0
Enter seconds the object falls: 5.75
In 5.75 seconds, the object falls 162.006 meters.
End program - Press any key to continue . . .
Sample Run #2:
=====================
Enter seconds the object falls: -10
Enter seconds the object falls: -1
Enter seconds the object falls: 0.75
In 0.75 seconds, the object falls 2.75625 meters.
End program - Press any key to continue . . .
*/
How do I program this properly in C++ programming ? Please follow the ToDos as assigned in the question
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
