- 3
hello plz i need the solution of trip planer code project
22 ответов
+ 5
Arij benlaine , it's really no that hard.
distance = time * speed
So time to cover some distance is
time= distance/40
But as you are required to return time in minutes, also multiply it by 60:
time = distance/40*60
Here is a complete code:
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
var time = (distance / 40) * 60;
console.log(time);
}
+ 2
distance = (distance / 40) * 60
+ 1
What you have to do is divide by 40, so you get the time it takes in hours and then multiply by 60 to take it to minutes
+ 1
thank uuuu so much
+ 1
the purpose of the task is not to give certain values like 590 or 100 as input and call the function by yourself many times. The input value is distance. Just perform the calculation this way:
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
var speed = 40
var minutes = distance / speed;
console.log(minutes *60);
}
0
What project is that?
0
the code project i cant solve it
0
If you do not say what the problem is, you will not be able to have a solution
0
well they give me problem to solve on that project when u end the basics lessons then u find code project in number 14
the problem is about to code what they said
u can check it for me on ur account if u had been solved it just tell me plz
0
You mean 14.1 or 14.2 of the sololearn Java course?
0
14.1
0
Sorry ... I don't have the pro version of the app
0
It's only for the pro version so I can't see it .if you copy it here it could help you
0
no sorry i mean before 14.1
there's 13 its a project
0
okey
0
You need to plan a road trip. You are traveling at an average speed of 40 miles an hour.
Given a distance in miles as input (the code to take input is already present), output to the console the time it will take you to cover it in minutes.
Sample Input:
150
Sample Output:
225
0
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
}
0
Good job
0
😉👍
0
Raphael , first of all there is no need for "main();" here
But your main problem is that you return the result form function main instead of printing it to the screen.
Your code should look something like that:
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
var time = (distance / 40) * 60;
console.log(time);
}