Need help for this please🙏 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Need help for this please🙏

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 Code Sample: function main() { var distance = parseInt(readLine(), 10); //your code goes here }

15th Jan 2021, 5:05 AM
SkyFreak
SkyFreak - avatar
11 Answers
+ 4
Gaudencio Agtong First learn concepts understand logic try some examples in sololearn you have lot of resources to learn. Without your effort we can't help try for yourself show your attempt after that you can post in q&a your code problem with proper tags. All the best haapy coding 👍
15th Jan 2021, 5:40 AM
R💠🇮🇳
R💠🇮🇳 - avatar
+ 3
Gaudencio Agtong Show your attempt
15th Jan 2021, 5:12 AM
Krish
Krish - avatar
+ 3
Very easy actually. Just do - var conversion = distance / 40; var output = conversion * 60; console.log(output); We want to find out the time so we do Time = Distance/Velocity (rearrange the formula) however we need to find the time in minutes, not hours so we times it by 60 to get the time in minutes. Hope this helps! 🙂
15th Jan 2021, 6:56 AM
aka :)
aka :) - avatar
+ 3
The problem is we are not taught parseint(redline(),10); before we get to this code challenge. So that is confusing many new learners.
15th Jan 2021, 9:40 AM
Chris Coder
Chris Coder - avatar
+ 3
Thank you so much for all of your suggestion and helps. I try to solve this as much as I can. Thank you very much❤
15th Jan 2021, 10:32 AM
SkyFreak
SkyFreak - avatar
+ 2
Gaudencio Agtong Useful Formulas: distance = velocity / time Here in this program: velocity ---> 40 miles / 60 minutes distance ---> Input time ---> Output (in minutes) The code is up to you. If you need more explanation about the logic, feel free to ask. And if you already have your code, please show us your attempt so we may help. Thanks and Good Luck!👍
15th Jan 2021, 6:02 AM
noteve
noteve - avatar
+ 1
That's the problem. I don't understand this😥
15th Jan 2021, 5:34 AM
SkyFreak
SkyFreak - avatar
+ 1
I done solving this thank you all
15th Jan 2021, 11:08 PM
SkyFreak
SkyFreak - avatar
+ 1
I don't usually give answers. But this question is very annoying and it is not explained very well. It forces you to dive right in and expect you to know what to do. Anyway, heres a solution. function main() { var distance = parseInt(readLine(), 10); //your code goes here var miles = 40; var minutes = 150 / miles; console.log(distance/40*60); }
16th Jan 2021, 10:10 AM
Chris Coder
Chris Coder - avatar
0
Thank you Gaudencio
5th Mar 2021, 2:58 PM
Kabelo Michael Letlala
Kabelo Michael Letlala - avatar
0
You are making a text encryptor. It should take multiple words and output a combined version, where each word is separated by a dollar sign $. For example, for the words "hello", "how", "are", "you", the output should be "$hello$how$are$you
quot;. The given code declares a class named Add, with a constructor that takes one rest parameter. Complete the code by adding a print() method to the class, which should generate the requested output. pls answer this question..!!
7th Apr 2021, 9:02 AM
krishna4444