Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IN JAVA PLEASE Problem 2: Marathon race time calculator Assume that marathon runners run the same pace (e.g. 10 minutes per mile) for the

image text in transcribed

CODE IN JAVA PLEASE

Problem 2: Marathon race time calculator Assume that marathon runners run the same pace (e.g. 10 minutes per mile) for the entire length of a race. In this task, you are going to create a calculator to predict the runner's completion time in hours and minutes. Using JOptionPane, ask the user for 2 inputs. This will be the expected pace per mile in minutes and seconds. Consider asking twice (one number each time) and storing them in String variables. Then convert those variables to numbers. Assume the user is kind and will enter a number (you do not have to check the input before converting it to number. We will see how to do this later in the course.) A marathon is 26.2 miles. Given the pace per mile, calculate the total time it will take the runner to complete the race. For example, if the user inputs 10 minutes and 10 seconds per mile, the output should be 4 hours and 26 minutes. Use JOptionPane.showMessage Dialog() to display your result. In the output, give a complete sentence. For example "Your expected finish time is 4 hours and 26 minutes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel 2024 In 7 Days

Authors: Alan Dinkins

1st Edition

B0CJ3X98XK, 979-8861224000

More Books

Students also viewed these Databases questions