Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

will like in java please A pedometer treats walking 2,000 steps as walking 1 mile. Write a steps ToMiles 0 method that takes the number

will like in java please
image text in transcribed
image text in transcribed
A pedometer treats walking 2,000 steps as walking 1 mile. Write a steps ToMiles 0 method that takes the number of steps as an integer parameter and returns the miles walked as a double. The steps ToMilesO method throws an Exception object with the message "Exception Negative step count entered " when the number of steps is negative. Complete the main0 method that reads the number of steps from a user, calis the stepsToMiles 0 method, and outputs the returned value from the steps ToMiles 0 method. Use a try-catch block to catch any Exception object thrown by the stepsToMiles ( method and output the exception message. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System. out.printf("\%. 2f", yourvalue); Exif the input of the program is 5345 the output of the program is: 2. 67 Ex If the input of the programis 3850 the output of the program is: Exceptions Negative step count entered. LabProgram.java

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

When should the last word in a title be capitalized?

Answered: 1 week ago

Question

What could motivate staff to participate?

Answered: 1 week ago