473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Convertind distances in program

Iam just a beginner, and I'm having a problem this program,,,,i did the first part but I didn't know how to do the conversions,,, can anybody help me with that..

---Write a program that inputs a decimal value for miles per hour and converts the value to minutes and seconds per mile.

Sample input, output:

For input 5.5 mph, the output should be 10 minutes and 55 seconds per mile.
Sep 26 '07 #1
3 1748
Ganon11
3,652 Expert 2GB
What you need to know is this:

1 hour = 60 minutes
1 minute = 60 seconds
1 hour = 60 * (60 seconds) = 3600 seconds

mph = Miles per hour = M / H
spm = Seconds per mile = S / M

You'll need to do the mathematical conversions above first, and then figure out how to get minutes/seconds per mile (rather than miles per minute/second).
Sep 26 '07 #2
RRick
463 Expert 256MB
5.5 mph is closer to 10 minutes 54.545454 seconds per mile.

To get to your answer you need to do a few steps.


  • Convert from mph to hpm(hour/mile). You invert your number (i.e. 1/x)
  • Convert from hpm to mpm(minute/mile). You multiply by how many minutes are in an hour.
  • You'll end up with a number that is a decimal number of minutes. You convert the minute fractional part to seconds, by mutipling the fractional part by how many seconds are in a minute.
Hope this helps,
Sep 26 '07 #3
RRick
463 Expert 256MB
Sorry, Ganon. It looks like our answers crossed in the posting.
Sep 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jayne Wolps | last post by:
Hello I wonder if anyone can help. I would like to know how certain sites: http://aboutbritain.com/ArundelCastle.htm, and http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx...
1
by: Tony Johansson | last post by:
Hello experts! As this program is now it's works perfectly when running as a application or as an Applet. Now to my question if I just change this row "public class Converter extends Applet "...
1
by: Hul Tytus | last post by:
comp.lang.c converting a point known by 4 distances to xyz coordinates? Amongst all the librarys on the internet there is certainly source for a routine that converts a point known by 4...
6
by: David Lozzi | last post by:
Hey All, I need to add a locator service for asp.net where a user would specify a zip code and then the returned list would be displayed in order of closest to furthest. I realize this is a third...
13
by: racygirl | last post by:
Hi all, I was just wondering, is it possible to write a solution to the following problem with the following criteria: 1. it must be as efficient as possible at run-time 2. be in O(1) 3. and...
0
by: tienlx | last post by:
Hi, I've a report (ReportAppointment.rdlc) in ASP.NET When viewing reports, the vertical distance between the two group are too big. I've tried to reduce the vertical distances but i can't. Demo:...
3
by: Paul Aspinall | last post by:
Hi Can anyone recommend a suitable way of calculating distances between UK post codes?? Many websites do this, and I'm wondering if there is some standard code, and where the reference DB comes...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
0
by: Fredrik Lundh | last post by:
aditya shukla wrote: Extracting is easy; you can do something like data = for line in open("test.txt"): line = line.split("|") data.append(float(line))
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.