Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Implement a function that when called returns Stopping Distance.
Formula for stopping distance is
Stopping Distance = (v × t) + { v² / [2 × g × ( f±G )] }
Where, g = gravity (9.8)
v = Vehicle Speed
t = perception Time
f= Coefficient of Friction
G= Grade of Road
for Uphill (Stopping Distance = (v × t) + { v² / [2 × g × ( f+G )] } )
for Downhill (Stopping Distance = (v × t) + { v² / [2 × g × ( f - G )] } )
When the function is called, it asks the values of above mentioned variables and returns the stopping distance.

What I have tried:

it is impossible for me to write code
Posted
Updated 26-May-16 20:51pm

Quote:
it is impossible for me to write code
Think about changing the domain of your study then.
This is real basic HomeWork. If 'it is impossible for you to write code' you have big problem.
 
Share this answer
 
"it is impossible for me to write code"
Then you are on the wrong course, and you will fail it.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
And we certainly aren't going to cheat you through a course you have no intention of trying to pass yourself. That wouldn't be fair on the rest of your class, or anyone who might employ you on the basis of your pass.
 
Share this answer
 
I show you a way to write a function for 'travel distance at constant speed'. I suppose it's just enough to make you figure out how to write the requested one.
Travel distance at constant speed = (v x t)
v = constant vehicle speed
t = elapsed time.


C++
double travel_distance(double v, double t)
{
  double distance = v * t;
  return distance;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900