Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write a program that will Calculate some of the costs for a road trip . Assume the user will drive an average of

image text in transcribedimage text in transcribed

You will write a program that will Calculate some of the costs for a road trip . Assume the user will drive an average of 70 MPH . The toll rate is 5 cents a mile . The user will stop and spend $15.00 every 4 hours for food and/or coffee The user will enter the number of miles, the cost of gas per gallon, and the miles per gallon(mpg) of the car. You must have at least 7 user defined functions as follows: //Road trip //preprocessor directives #defineCRTSECURENOWARNINGS #include ---- #define SPEEDLIMIT 70 #define TOLLRATE .05 #define ENERGYCOST 15.00 //Greet the user void Greeting); //Calculations for one road trip void OneRoadTrip); //get input (y or n) to continue void GetYesorNo (char *inputPtr); //Calculate the cost of the gas void CalculateGasCost (double miles, double *gasCostPtr); //calculate the time in hours and minute:s void CalculateTime (double miles, double *tripTimePtr, int *hoursPtr, int *minutesPtr); //calculate the cost of food/energy void CalculateEnergyCost(double tripTime, double *foodCostPtr); //calculate cost of tolls and return the total cost of gas, tolls, and food double CalculateCost (double miles, double gasCost, double foodCost, double tollCostPtr); Additional Requirements Use function prototypes Write comments for each function that will appear in the file before each prototype and again before each function definition Be sure to comment your code adequately Be sure to indent properly. Check your textbook examples to see how it should be done Use meaningful variable names . . . NO Late Submission

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions