Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

JadeEyes Group Title

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)

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. JadeEyes Group Title
    Best Response
    You've already chosen the best response.
    Medals 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*(time-hour); <----- 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++.

    • 2 years ago
  2. compute Group Title
    Best Response
    You've already chosen the best response.
    Medals 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; }

    • 2 years ago
  3. JadeEyes Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thank you again...!! :) ..!!

    • 2 years ago
  4. compute Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    its k...

    • 2 years ago
    • Attachments:

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.