Write an algorithm for computing the distance traveled for some object. The init
ID: 3796814 • Letter: W
Question
Write an algorithm for computing the distance traveled for some object. The initial velocity, the final velocity, and the amount of time object traveled are required inputs for this problem. The output is the distance traveled. Use plain English statements (no programming instructions required), and number your steps. For our purpose you may ignore units. We would like for the distance traveled to be a floating point value. Discuss any issues involved in making sure that a C program will compute the correct value using the formula above.Explanation / Answer
ALGORITHM Dist()
{
// the equation used to solve the given problem is s=v t+(1/2)a t2 , where d is distance traveled in a //certain amount of time (t), v is starting velocity, a is acceleration (must be constant), and t is time. //This gives you the distance traveled during a certain amount of time
1. Read the value for initial velocity (v)
2. Read the time taken to travel (t)
3. Read the acceleration value(a)
4. Compute x= v*t
5. Compute y=(1/2)a t2
6. Compute s=x+y
7. display the distance travelled (s)
}
ALGORITHM Dist()
{
// the equation used to solve the given problem is s=v t+(1/2)a t2 , where d is distance traveled in a //certain amount of time (t), v is starting velocity, a is acceleration (must be constant), and t is time. //This gives you the distance traveled during a certain amount of time
1. Read the value for initial velocity (v)
2. Read the time taken to travel (t)
3. Read the acceleration value(a)
4. Compute x= v*t
5. Compute y=(1/2)a t2
6. Compute s=x+y
7. display the distance travelled (s)
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.