Question

Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPo...

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 third parameter indicates the speed of the vehicle in miles per hour. The function returns the number of hours it takes a vehicle to go 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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

double timeOnHighway (double mileEndingPoint,double mileStartingPoint=0.0,double speed=55.0)

{

return ((mileEndingPoint - mileStartingPoint)/ speed );

}

Add a comment
Answer #2
DELETED
Add a comment
Know the answer?
Add Answer to:
Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPo...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT