Question: my code is not finished . im making a trip planner,in programmin c the code is below: //Program for roadtrip cost calculation #include #define SPEEDLIMIT

my code is not finished . im making a trip planner,in programmin c
the code is below:
//Program for roadtrip cost calculation
#include
#define SPEEDLIMIT 70
#define TOLLRATE 0.05
#define ENERGYCOST 15.00
double miles,gasprice,capacity,gasCost,tripTime,hours,minutes,tollCost,totalCost,foodCost;
void Greeting(); //To greet the user
void OneRoadTrip(); //Calculations for one roadtrip
void GetYesOrNo(char *inputptr); //get input y or n to continue
void CalculateGasCost(double miles, double *gasCostPtr); //calculate the cost of the gas
void CalculateTime(double miles, double *tripTimePtr, int *hoursPtr, int *minutesPtr); //calculate the time in hours and minutes
void CalculateEnergyCost(double tripTime, double *foodCostPtr); //calculate the cost of food/energy
double CalculateCost(double miles, double gasCost, double foodCost, double *tollCostPtr); //calculate cost of tolls and return total cost of gas, tolls and food
/* This function greets the user for thr road trip planner */
void Greeting()
{
printf("welcome to the roadtrip planner ");
printf("The calculations are based on the driver travelling 70 MPH ");
printf("Stopping every four hours for a $15.00 snack and a 5 cent for mile toll");
}
/* This function gets inputs from the user either yesr or no */
void GetYesOrNo(char *inputptr)
{
printf("Do u want to enter trip details yes or no: ");
scanf("%c",&inputptr);
}
/* This function gets the input of miles, price of gas per gallon and car capacity.
And it prints the output of total cost of trip. */
void OneRoadTrip()
{
printf("Enter distance of the trip in miles: ");
scanf("%lf",&miles);
printf("Enter the price of the gas per gallon: ");
scanf("%lf",&gasprice);
printf("How many miles can your car travel on a gallon of gas(MPG): ");
scanf("lf",&capacity);
printf("Total cost of gas for trip is: %lf ",gasCost);
printf("It will take you %lf hours to reach your destination at a rate of 70 MPH",tripTime);
printf(" That translates to %d hours and %d minutes",hours,minutes);
printf(" The cost of tolls for your trip at rate of five cents for miles is %lf",tollCost);
totalCost= CalculateCost(miles, gasCost,foodCost,&tollCost);
printf(" On this trip you will spend a total of %lf for gas,food and tolls.",totalCost);
}
/* This function calculates the cost of gas for the whole trip*/
void CalculateGasCost(double miles, double *gasCostPtr)
{
*gasCostPtr=(miles/capacity)*gasprice;
}
/* This function calculates the time taken to reach the destination */
void CalculateTime(double miles, double *tripTimePtr, int *hoursPtr, int *minutesPtr)
{
int temp;
*tripTimePtr = miles/SPEEDLIMIT;
*hoursPtr = miles/SPEEDLIMIT;
temp = *tripTimePtr - *hoursPtr;
*minutesPtr = temp*60;
}
/* This function calculates the food costs */
void CalculateEnergyCost(double tripTime, double *foodCostPtr)
{
*foodCostPtr= (tripTime/4) * ENERGYCOST;
}
/* This function calculates the total cost of the journey.
It also calls the previous functions to calculate food cost, gas cost and toll cost and return the total cost */
double CalculateCost(double miles, double gasCost, double foodCost, double *tollCostPtr)
{
*tollCostPtr = miles*TOLLRATE;
CalculateGasCost(miles, &gasCost);
CalculateTime(miles, &tripTime, &hours, &minutes);
CalculateEnergyCost(tripTime,&foodCost);
return (*tollCostPtr+foodCost+gasCost);
}
 my code is not finished . im making a trip planner,in

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 MPHH . The toll rate is 5 cents a mile .The user will stop and spend S15.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 #defineCRTSECURE NO WARNINGS #include - - #define SPEEDLIMIT 78 #define TOLLRATE "es #define ENERGYCOST 15.ee //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 minutes void CalculateTime(double miles, double *tripTinePtr, nt *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); 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!