Answer:
// program in C++.
#include <bits/stdc++.h>
using namespace std;
// function to calculate Distance
void CalcPrintDistance(double velo,double mint)
{
// calculate Distance traveled
double dist=(velo*mint)/60;
// print the Distance
cout<<fixed<<setprecision(2)<<"Distance traveled by vehicle is:"<< dist<<" miles"<<endl;
}
// driver function
int main() {
// variables
double speed,trv_time;
cout<<"Enter the velocity (miles per hour):";
// read speed of the vehicle
cin>>speed;
cout<<"Enter the time traveled(in minutes):";
// read the time traveled
cin>>trv_time;
// call the function
CalcPrintDistance(speed,trv_time);
return 0;
}
Step-by-step explanation:
Read the velocity of vehicle and assign it to variable "speed".Read the time traveled by the vehicle and assign it to variable "trv_time".Call the function CalcPrintDistance() with parameter "speed" and "trv_time".This function will calculate the distance traveled and print it.
Output:
Enter the velocity (miles per hour):68.2
Enter the time traveled(in minutes):34.6
Distance traveled by vehicle is:39.33 miles