Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

slove in C++ You would like to know how fast you can run in miles per hour. Your

ID: 3722993 • Letter: S

Question

slove in C++

You would like to know how fast you can run in miles per hour. Your treadmill wil tell you your speed in terms of a pace (minutes and seconds per mile, such as "5:30 mile") or in terms of kilometers per hour (kph). Write an overloaded function called convertToMPH. The first definition should take as input two integers that represent the pace in minutes and seconds per mile and return the speed in mph as a double. The second definition should take as input one double that represents the speed in kph and return the speed in mph as a double. One mile is approximately 1.61 kilometers. Write a driver program to test your function.

Explanation / Answer

#include <iostream>

double convertToMPH(double);
double convertToMPH(int,int);

int main() {
double converted;
  
std::cout<< convertToMPH(1);
std::cout<<" ";
std::cout<< convertToMPH(5,30);
}


double convertToMPH(double kph)
{
double miles;
miles = kph/ 1.61;
return miles;
}

double convertToMPH(int pace,int seconds)
{
double miles;
miles = (double)3600 / ((pace * 60) + seconds);
return miles;
}