Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ programming question. n part 1 you will be creating multiple functions to calculate the distance an object falls (on earth) in a specified number
C++ programming question.
n part 1 you will be creating multiple functions to calculate the distance an object falls (on earth) in a specified number of seconds. All of the functions in part 1 will have a specific function signature. For one of the required functions, there will be unit tests at the function call level. The unit tests will call a function with specific values to ensure the function returns back the correct value. If these unit tests fail it is likely all of the other tests will fail as well. This is a new type of test we have not seen before Make sure you exactly match any function signatures that are required by the exercise. You are not allowed to use any global variables. Use of global variables will result in a grade of zero for part In addition to the main function you have been creating in all the lab lessons so far you will need three (3) additional functions One function will be an input function that will read in a double value from cin and return that value back to main. You will also need an output function that will display both the number of seconds an object has fallen as well as the distance the object has fallen. The final function will calculate the distance an object falls (on earth) during the specified number of seconds Here are the required signatures of the three functions you need (in addition to the main) function: double readSeconds () void displayResults (double seconds, double distance) double calculateDistance (double seconds) Here is a summary of the processing that is required in the various functions double readSeconds () This function reads in a value from cin. If the value is 0 or more the value should be returned to the calling function. If the value is less than zero you should read in a new value. This function should have a loop that continues to execute until a valid input value has been entered. You can assume that the input values are always valid numbers. The prompt from the function should be: Enter the time (in seconds)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started