#include <cstdlib>
#include <iostream>
#include <iomanip>
usingnamespace std;
double getDistance();
int getPassengerCount();
float calculateFare (double distance, int count);//changed to float because it's better for money value
constdouble rate = 2.40;
constdouble surcharge = 1.20;
int main(int argc, char *argv[])
{
double distance = 0;
int count = 0;
float total = 0;//added a total variable
cout<<"Enter distance traveled: ";
cin>>distance;
cout<<"Enter number of passengers: ";
cin>> count;
total=calculateFare(distance , count);//made it so a variable total is equal to an outcome of function calculateFare
cout<< "It will cost $"<<total<< " for " << count <<
" passenger(s) to travel "<< distance << "miles in my taxi."<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
float calculateFare(double d, int c)
{
constdouble rate = 2.40;
constdouble surcharge = 1.20;
float t;
if (c = 1)
{
t = d * rate;
}
else
{
t= (d * rate) + (surcharge * c);
}
return t;//made it so fucntion returns the t variable
}