CPSC 120 Postlab 2: Finding Your Pace
Due Friday September 17, 2004 at noon


For runners, race distances are often given in kilometers -- 5K, 10K, etc. A fast runner might run a 5K race in 20 minutes or so; the winning time is usually closer to 15 minutes, and most of the population comes in between 20 and 35 minutes. It's interesting to think of what these times translate to in miles per hour (MPH). In this assignment you will write a program that relates the user's race time to their speed in MPH.

Your program should ask the user for the following input:

Your program should print the user's pace in MPH, then ask the user what pace he or she is trying to achieve. After reading in this information, the program should print what time the user would need to run a race of the given distance in to achieve this pace.

A sample run of your program for a user who ran a 5K in 27 minutes and 15 seconds might look like this (items in bold are entered by the user):

Enter the number of kilometers run: 5
Enter the minutes part of your time: 27
Enter the seconds part of your time: 15
Your pace is 6.8807339449541285 MPH.
How fast do you want to go, in MPH? 10
To go that fast, you would have to run your distance in 18.75 minutes.

Planning Your Program

Be sure to put your name, the file name, and a description of the program in the header.

What to turn in

Turn in hardcopy of your program and e-mail the .java file to your instructor @roanoke.edu with cpsc120 post2 in the subject.