- 3
Please Can anyone create code for following problem
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 Explanation: It will take 150/40 = 3.75 hours to cover the distance, which is equivalent to 3.75*60 = 225 minutes.
19 odpowiedzi
+ 3
👉Please tag the relevant programming.
👉Hint:
* speed = distance / time
* solve formulafor time
* output in minutes
👉PLEASE SHOW YOUR CODE ATTEMPT SO WE CAN HELP YOU.
+ 2
Now i got my answer thanku prince kumar
+ 1
Please can you be my mentor?
+ 1
miles = int(input("Distance in miles: "))
answer = (int(miles / 40))
result = (answer * 60)
print(result + 45)
0
I try best but i am unable to creat.please guide me
0
In this code what is 1.5?
0
Please explain what is 60/40? Is it distance/time?
0
Is it time/distance? If yes then time/distance is equal to what?
0
Please only tell me 60/40 is equal to what ? After that i will never post
0
Ok thankx alot
0
It would be better if you can specify the programming language in which you want the code
Anyway, it gives something like this below in Python
# here is the code
distance = int(input()) # you could convert it to float if you want
time = (distance/40)*60 # calculate and convert time in minutes
print (time)
I will appreciate other approaches
0
Show your code we will show ur errors..
0
public class DivisionPorRestasSucesiva {
public static void main(String[] args) {
int v =40, d=150, m=60;
float t=(float)d/v;
float r=t*m;
System.out.println(r);
}
}
0
Hacker I finished the course first then went back to complete those extra bits.
0
Hacker it wants you to create 2 variables to store the data. Each variable should equal the formula. Then it wants to output the time in the console.log( )
- 1
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
console.log(225*3.75)
}
I tried this code
- 1
Anyone are going to help me ? I am beginner but really passion in learning coding
- 2
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
console.log(225*3.75)
}
Here is my code attempt .i just write console .var was already writen