Can anyone help me to solve this js project?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me to solve this js project??

Trip Planner 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

25th Feb 2021, 2:38 PM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
14 Answers
+ 2
function main() { var distance = parseInt(readLine(), 10); //your code goes here var miles = 40; var minutes = distance / miles; console.log(distance / 40 * 60); }
27th Feb 2021, 8:48 AM
Ahmed Mohammed Alnor Abdalmahmod Abdalslam
Ahmed Mohammed Alnor Abdalmahmod Abdalslam - avatar
25th Feb 2021, 3:53 PM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
0
Hi! have you tried to solve this problem yourself? can I see your code? this will help a lot in the solution
25th Feb 2021, 2:51 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
I have understood the question. But Don't know how to solve ♤♢☞ 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ☜♢♤
25th Feb 2021, 3:01 PM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
0
what are your thoughts on this? share them
25th Feb 2021, 3:04 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
I have tried.here it is. //this project is given by sololearn /*function main() { var distance = parseInt(readLine(), 10); */ //your code goes here function main() { var x =parseInt(document.getElementById('input').value); var distance=(x/40)*60; return distance ; document.getElementById('output').innerHTML=distance; } // i write this. But i have been told that, i have to show the result at console panel. Ярослав Вернигора(Yaroslav Vernigora)
25th Feb 2021, 3:30 PM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
0
all right. why are you making this so difficult? we made a decision in the form of a function. this is unnecessary. drop the function, use the formula... and what command is called by the console?
25th Feb 2021, 3:38 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
I am newcomer in programming language. That's why I didn’t realise that it had become so complicated. This is the command >output to the console the time it will take you to cover it in minutes. Ярослав Вернигора(Yaroslav Vernigora)
25th Feb 2021, 3:47 PM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
0
try to use console.log() for output. In other cases use document.write()
25th Feb 2021, 3:51 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
you are using the formula correctly. remove the function. this is unnecessary. you can create only one variable (for example, dist_rezult), where you will write the conversion result. you will take the initial value from the distance variable. then use the console call command to output this result (dist_rezult)
25th Feb 2021, 3:58 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
in python all you need to do is: a=int(input( )) print(a*60/40)
27th Feb 2021, 9:04 AM
Central Processing Unit
Central Processing Unit - avatar
27th Feb 2021, 9:16 AM
Md. Nazmul Islam
Md. Nazmul Islam - avatar
0
Look at my code above
27th Feb 2021, 12:50 PM
Ahmed Mohammed Alnor Abdalmahmod Abdalslam
Ahmed Mohammed Alnor Abdalmahmod Abdalslam - avatar
0
I want the solition for words project please can any one share that
9th Jul 2021, 10:33 AM
CHANTHINI N
CHANTHINI N - avatar