+ 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 }
11 Réponses
+ 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 👍
+ 3
Gaudencio Agtong
Show your attempt
+ 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! 🙂
+ 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.
+ 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❤
+ 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!👍
+ 1
That's the problem. I don't understand this😥
+ 1
I done solving this thank you all
+ 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);
}
0
Thank you Gaudencio
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$youquot;.
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..!!