Write the definition of a function named timeOnHighway that receives three param
ID: 1925199 • Letter: W
Question
Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPoint , mileStartingPoint , and speed . The first two parameters indicate the mile markers on an interstate at which a vehicle goes to and starts at; the second parameter indicattes the speed of the vehicle in miles per hour. The function and returns the number of hours it takes a vehicle to from the starting mile marker to the ending one. The function has a default value for the speed: 55 miles per hour, and a default value for mileStartingPoint : 0.0.Explanation / Answer
The declaration of the function is: double timeOnHighway(double mileEndingPoint, double mileEndingPoint = 0.0, int speed = 55); The definition simply takes the time, distance formula T = R*D
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.