First part of the challenge is almost written out as is, but the second part requires solving quadratic equation.
Solution in Haskell:
dist::Double->Double->DoubledistvKmhmu=d_reaction+d_brakingwhered_reaction=v*t_reactiond_braking=(v*v)/(2*mu*g)v=fromKmhvKmhspeed::Double->Double->Doublespeeddmu=toKmhvwhere-- Solve using quadratic formulav=(-b+(sqrt$b*b-4*a*c))/(2*a)a=1/(2*mu*g)b=1/t_reactionc=-dfromKmh::Double->DoublefromKmhv=v*1000/3600toKmh::Double->DoubletoKmhv=v*3600/1000g::Doubleg=9.81t_reaction::Doublet_reaction=1
First part of the challenge is almost written out as is, but the second part requires solving quadratic equation.
Solution in Haskell:
Tests: