//Maxwell Brewer CS1A Chapter 3, P. 143, #1
//
/***************************************************************
*
* CALCULATE FUEL ECONOMY
* _____________________________________________________________
*
* This program will receive input from the user
* and output a calculation of fuel economy. The
* user will input the vehicle fuel tank capacity
* and total distance traveled.
* _____________________________________________
* INPUT
*
* Fuel tank capacity
* Total distance traveled on full tank.
*
* OUTPUT
*
* Average fuel consumption
*
***************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
// Initialization
float galFuel; //INPUT - Fuel tank capacity
float distanceMi; //INPUT - Total distance on a full tank
float averageFuel; //OUTPUT - Average distance per gallon
const char msgGal[] = "Enter total gallons per tank: ";
const char msgDis[] = "Enter total distance per tank: ";
const char msgVeh[] = "Your vehicle can travel";
const char msgMpg[] = " miles per gallon.";
// Display data
cout << msgGal << endl;
cin >> galFuel;
cout << msgDis << endl;
cin >> distanceMi ;
// Output
averageFuel = distanceMi / galFuel;
// Display Output
cout << setprecision(2) << fixed;
cout << msgVeh << setw(6) << averageFuel << msgMpg;
return 0;
}