0
Trip planner code project
Please I need help in completing the trip planner code project ? Anybody to help me out please
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);
}
+ 1
Please post your code so we can see where you make mistake.
+ 1
All sorted out thanks to your detail explanationđ€đ
0
Yes under javascript course
0
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
}
0
My noob answer
var a = 40
var b = 590
var min = 60
console.log((distance/a)*min)