Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
Write a program to calculate the estimated journey time of a train. The program should request and read the distance in miles and the average speed in miles per hour, and display the estimated journey time in hours and minutes to the nearest ninute.
Test your program with:
(a) Distance = 1.01, speed = 1.(Result should be 1 hour & 1 minute)
(b) Distance = 1.005, speed = 1.(Result should be 1 hour & 0 minute)
 one year ago
 one year ago
Write a program to calculate the estimated journey time of a train. The program should request and read the distance in miles and the average speed in miles per hour, and display the estimated journey time in hours and minutes to the nearest ninute. Test your program with: (a) Distance = 1.01, speed = 1.(Result should be 1 hour & 1 minute) (b) Distance = 1.005, speed = 1.(Result should be 1 hour & 0 minute)
 one year ago
 one year ago

This Question is Closed

JadeEyesBest ResponseYou've already chosen the best response.0
The codes I entered: #include<iostream.h> #include<stdio.h> int main () { float distance,speed,time; int hour,minute; printf("Enter Distance Of Journey(in miles):\n"); scanf("%f",&distance); printf("Enter Average Speed Of Train(in miles per hour):\n"); scanf("%f",&speed); time = distance/speed; hour = distance/speed; minute = 60*(timehour); < Problem here : For any value minutes=zero printf("Approximate Journey Time: %d hour and %d minutes.\n",hour,minute); system("pause"); return 0; } Can anyone help me resolve this problem? I'm using Dev C++.
 one year ago

computeBest ResponseYou've already chosen the best response.2
#include<stdio.h> int main () { float distance,speed,time,minute; int hour,min; printf("Enter Distance Of Journey(in miles):\n"); scanf("%f",&distance); printf("Enter Average Speed Of Train(in miles per hour):\n"); scanf("%f",&speed); time = distance/speed; minute = 60*time; if(minute>=60) { hour=minute%60; min=minute/60; } printf("Approximate Journey Time: %d hour and %d minutes.\n", hour,min); system("pause"); return 0; }
 one year ago

JadeEyesBest ResponseYou've already chosen the best response.0
Thank you again...!! :) ..!!
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.