Hey, I got this program where I have to write simple functions to calculate the time and cost for a roadtrip. I keep on getting errors on the travelTime() and travelcost() functions. The errors are error C2063: 'travelTime' : not a function and error C2063: 'travelcost' : not a function. Here is my code and any help would be appreciated.
Code:
#include <stdio.h>
#define MINUTES 60;
/*function prototype*/
int roundUp(float);
float travelTime(int, int, int);
float travelcost(int, int, float, float);
/*Main Function*/
int main()
{
/*declaire variables*/
int miles, carGasMileage, gasTankSize = 15, averageSpeed, restTime;
float pricePerGall = 1.40, travelTime, travelcost, fillupTimes, mealCost;
/*Get miles variable*/
printf("How many miles are you going to travel?: ");
scanf("%d", &miles);
/*Get car gas mileage*/
printf("\nWhat is the gas mileage that your car gets?: ");
scanf("%d", &carGasMileage);
/*Get average speed*/
printf("\nWhat is the average spped that you want to travel in mph units?: ");
scanf("%d", averageSpeed);
/*Get rest time--NOTE I had to eliminate the Brother rest time for this program-There had to be only one rest time*/
printf("\nHow many minutes do you plan on resting?: ");
scanf("%d", &restTime);
/*Get meal cost*/
printf("\nHow much will you spend on meals?: ");
scanf("%f", &mealCost);
/*clear screen*/
system("cls");
/*calculate the time*/
travelTime(miles, averageSpeed, restTime);
/*calculate the cost*/
travelcost(miles, carGasMileage, pricePerGall);
/*calculate the times that they will need to fill-up*/
fillupTimes = (miles / carGasMileage) / (gasTankSize * 7/8);
roundUp(fillupTimes);
/*display RoadTrip Results*/
printf("So, you're taking a trip to the Beach?\n");
printf("Are you interested in how long it is going to take?\n");
printf("It will take %5.0f minutes\n\n", travelTime);
printf("Dude, Do you want to know how much it is going to cost?\n");
printf("It will cost $%4.2f\n\n", travelcost);
printf("You are going to have to fill up %3.2f times on your way there.\n\n", fillupTimes);
return 0;
}
int roundUp()
{
float a1, a2;
int b1;
b1 = a1;
a2 = a1 - b1;
if (a2 > 0.) b1++;
return (b1);
}
float travelTime()
{
int miles, averageSpeed, restTime;
float time;
if (miles > 0){
time = (miles / averageSpeed) * MINUTES + restTime;
}
else
printf("You didn't go anywhere!");
return (time);
}
float travelcost()
{
int miles, carGasMileage;
float pricePerGall = 1.40, cost, mealCost;
if (miles > 0){
cost = (miles / carGasMileage) * pricePerGall + mealCost;
}
else
printf("You didn't go anywhere!");
return (cost);
}