// ****************************************************************************
//  Jeff Balsley  10/15/2001
//
//  Assignment: 4.	Write a program that invokes a function to
//  calculate the number of gallons of fuel required for traveling 2000 miles.
//  The car gets 16.5 miles to the gallon. If fuel is $1.52 a gallon and its
//  costs $0.26 to operate the car each mile, write a second function to
//  calculate the total cost of the trip.
//
// ****************************************************************************
//  Known Bugs:
//
//
// ****************************************************************************

#include<iostream>
using namespace std;

double calculate_cost();

const double mpg = 16.5;              // the car gets 16.5 miles per gallon
const double fuel_cost = 1.52;        // gas costs $1.52 per gallon
const double op_cost = .26;           // operation costs per mile
const double trip_distance = 2000.0;  // the trip is 2000 miles

int main()
{
	cout.precision(2);
	cout.setf(ios_base::fixed);
	cout << "The total cost of the trip will be $" << calculate_cost();
	cout << "\n";

  	return 0;
}

// ***************************************************************************
//  This code takes no input as it uses all global variables to calculate
//  the trips total cost.
// ***************************************************************************

double calculate_cost()
{
	return((trip_distance / mpg)*fuel_cost + trip_distance*op_cost);
}
