I believe I am supposed to use loops in this program but I am not really sure ho
ID: 3623395 • Letter: I
Question
I believe I am supposed to use loops in this program but I am not really sure how to write any of it. Please help! Will rate lifesaver if all is correct!_________________________________________________________________________
For this assignment, write a program that will analyze the data from a physics experiment.
The data consists of a series of position measurements for a moving object. The position measurements will be entered by the user of the program as they are continually prompted. Each of the position measurements that the user enters will have been recorded at uniform time intervals. This time interval will be entered by the user when the program begins and will be followed by the series of position measurements. Each position should be greater than or equal to the previous position because the object is either moving in one direction or still, but never moving backwards. Therefore a negative position measurement will be used to signal the end of the user's data for the run of the program.
After each of the position measurements has been entered, calculate and display the following:
1. the average velocity for the time interval
2. the average acceleration for the time interval
Calculations
Use the following formulas for the calculations:
change of position = current position - previous position
change of velocity = current velocity - previous velocity
average velocity = change of position / time interval
average acceleration = change of velocity / time interval
Notes
1. The starting position and starting velocity should both be 0.
2. There should be a loop to validate the position entered by the user. As stated earlier, each position that the user enters must be greater than or equal to the previous position. Each time the user enters an invalid position, an error message that includes the invalid position as well as the previous valid position should be displayed and the user should be given a chance to enter the current position again.
Processing Requirements
1. At the top of the C++ source code, include a documentation box that resembles the ones from programs 1 and 2.
2.The program should be fully documented.
3. Use meaningful variable names.
4. Make sure and test the program with values other than the ones in the Sample Output.
Sample Output
Motion Analysis
Enter the uniform time interval in seconds: 2.5
Enter a position in feet (negative value to quit): 2
Average velocity (this interval): 0.80 feet/second
Average acceleration: 0.32 feet/second/second
Enter a position in feet (negative value to quit): 5
Average velocity (this interval): 1.20 feet/second
Average acceleration: 0.16 feet/second/second
Enter a position in feet (negative value to quit): 4
Invalid value: 4 is less than the current position of 5. Try again.
Enter a position in feet (negative value to quit): 12
Average velocity (this interval): 2.80 feet/second
Average acceleration: 0.64 feet/second/second
Enter a position in feet (negative value to quit): -1