Question: Need a code for this in c++ base template A pedometer treats walking 2,000 steps as walking 1 mile. Write a StepsToMiles 0 function that
Need a code for this in c++
base template

A pedometer treats walking 2,000 steps as walking 1 mile. Write a StepsToMiles 0 function that takes the number of steps as an integer parameter and returns the miles walked as a double. The StepsToMiles 0 function throws a runtime_error object with the message "Exception: Negative step count entered." when the number of steps is negative. Complete the main 0 function that reads the number of steps from a user, calls the StepsToMiles() function, and outputs the returned value from the StepsToMiles ( function. Use a try-catch block to catch any runtime_error object thrown by the StepsToMiles() function and output the exception message. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout fixed setprecision (2); once before all other cout statements. Ex: If the input of the program is: 5345 the output of the program is: 2.67 Ex: If the input of the program is: 3850 the output of the program is: Exception: Negative step count entered
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
