+ 1

Trip Planner

HI Team, i have problems with this project if i done the first case right the second is wrong this is my code: function main() { var distance = parseInt(readLine(), 10); //your code goes here var distance = 590; var speed =40; var time = (distance/speed)*60; console.log(time) var distance = 100; var speed=40; var time=(distance/speed)*60; console.log(time); } The output is: 885 150 Pls tell me how i should complete it! BTW now both cases are wrong!

24th Jul 2022, 6:14 PM
Rusu Silviu
Rusu Silviu - avatar
3 odpowiedzi
+ 5
U don't need to provide input values....U can just solve it this way....🙂👇🏻 function main() { var distance = parseInt(readLine(), 10); //your code goes here var time=(distance/40)*60; console.log(time); }
25th Jul 2022, 12:06 AM
Sneha_Gupta✨
Sneha_Gupta✨ - avatar
+ 1
Rusu Silviu don't hard code the input values. Take input from the console. The input line is already given for you in the starter code, and you overwrote the input with a hard-coded number. Code Coach will supply the input.
24th Jul 2022, 6:16 PM
Brian
Brian - avatar
+ 1
Thx for the help!
25th Jul 2022, 7:24 AM
Rusu Silviu
Rusu Silviu - avatar