Trip planner code project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Trip planner code project

Please I need help in completing the trip planner code project ? Anybody to help me out please

9th Aug 2022, 9:25 AM
Tunde Fadipe
Tunde Fadipe - avatar
6 Answers
+ 1
In this code challange your goal is to calculate how much time in minutes will take to go to some place(travel distance) if you are traveling 40miles per hour. You get distance as input, you need to calculate first how much hours it will take(time). If you read again task desctiption/explanation you would see that you need to divide distance by speed to get time. If you don't know formulas use internet to find it: https://www.calculatorsoup.com/calculators/math/speed-distance-time-calculator.php When you do this, you will get time per 1 hour, now you just need to convert hours to minutes and your task is completed. To do this just multiply result by 60 (because we have 60 minutes in one hour) - if you don't know formulas use internet to find it. Here is full code: function main() { var distance = parseInt(readLine(), 10); //your code goes here var speedPerHour = 40; var timeInMinutes = distance / speedPerHour * 60; console.log(timeInMinutes); }
9th Aug 2022, 1:43 PM
PanicS
PanicS - avatar
+ 1
Please post your code so we can see where you make mistake.
9th Aug 2022, 9:33 AM
PanicS
PanicS - avatar
+ 1
All sorted out thanks to your detail explanation🤝🙌
11th Aug 2022, 4:59 PM
Tunde Fadipe
Tunde Fadipe - avatar
0
Yes under javascript course
9th Aug 2022, 9:30 AM
Tunde Fadipe
Tunde Fadipe - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here }
9th Aug 2022, 9:40 AM
Tunde Fadipe
Tunde Fadipe - avatar
0
My noob answer var a = 40 var b = 590 var min = 60 console.log((distance/a)*min)
7th Oct 2022, 5:07 AM
Azlan