The following formula can be used to determine the displacement of an object: d
ID: 3823658 • Letter: T
Question
The following formula can be used to determine the displacement of an object: d = V_o *t = 1/2 at^2 where v_o is initial velocity and is 5m/s, a is acceleration and is 3.5 m/s, t is the time in seconds and d is the displacement or distance travelled in meters and will be computed. Compute d by: 1. Sending an object's travelling time into a function named displacement that accepts the object's travelling time (in seconds) as an argument. The function should return the distance, in meters, that the object has been displaced or moved. 2. The call to this function will be placed inside of a loop in the main function that iterates time from 1 to 10. The call to the displacement function with time being the argument will be made each time the loop is passed through. The function will compute displacement and return the value to the main. A new value of t is passed into the function each time the loop is repeated with a new value of t as the argument to the function. Return value of the distance in a cout statement that indicates the distance for the corresponding value of t.Explanation / Answer
#include <iostream>
using namespace std;
int displacement(int time)
{
int distance;
distance=5*time + 0.5*3.5*time*time;
return distance;
}
int main()
{
for(int i=1;i<=10;i++)
{
cout<<" At time t= "<<i<<"second "<<"distance moved= "<<displacement(i)<<"meters";
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.