+ 1
How will you output to the console the time it will take you to cover it in minutes
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. Explanation: It will take 150/40 = 3.75 hours to cover the distance, which is equivalent to 3.75*60 = 225 minutes. https://code.sololearn.com/WEeiUN5740UL/?ref=app
11 Answers
+ 3
(function time (inp,dis))
//first you create a function {
// then you do the basic maths and return it the question already explained and make sure to return it
return (inp/dis)*60;
}
//then console.log the function while you input the values
console. log(time(distance,40));
}
+ 3
I don't understand why you need to ask how to do this when the question practically provides the answer.
But here is a Python example
# Enter distance to travel
print(int(input())/40*60,'minutes')
+ 1
Rik Wittkopp check my code pls
+ 1
Don't worry about the inp and dis I just used them for representing
+ 1
Had a look & have posted DM
Good luck
0
Rik Wittkopp I'm not getting it
0
align table rows in horizontal form using consol
0
on this code
class Add {
constructor(...words) {
this.words = words;
}
//your code goes here
print(){
for(let i of this.words.values())
console.log("quot;+i+"quot;);
}
}
var x = new Add("hehe", "hoho", "haha", "hihi", "huhu");
var y = new Add("this", "is", "awesome");
var z = new Add("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
x.print();
y.print();
z.print();
0
here is his result
$hehe$
$hoho$
$haha$
$hihi$
$huhu$
$this$
$is$
$awesome$
$lorem$
$ipsum$
$dolor$
$sit$
$amet$
$consectetur$
$adipiscing$
$elit$
0
I want him to look like this
$hehe$hoho$haha$hihi$huhu$
$this$is$awesome$
$lorem$ipsum$dolor$sit$amet$consectetur$adipiscing$elit$