// Eric Bernal Chapter 2, P. 83 #11 CS1A
/******************************************************************************
Compute distance per tank of gas
*_______________________________________________________________________________
This program will calculate the distance a car could travel based on it's tank
capacity.
Computation formula:
Distance = Tank Capacity x Average Mile per Gallon
*_______________________________________________________________________________
INPUT
Tankcapacity : Amount of gas gallons the car can carry
mpgCity : Average mpg in city
mpgHighway: Average mpg at highway speeds
OUTPUT
Distance : The distance the car could travel
*******************************************************************************/
#include <iostream>
using namespace std;
int main() {
float Tankcapacity; // INPUT = Amount of gas gallons the car can carry
float mpgCity; // INPUT = Average mpg in city
float mpgHighway; // INPUT = mpgHighway = Average mpg at highway speeds
float Distance; // OUTPUT = Distance the car traveled
Tankcapacity = 20;
mpgCity = 21.5;
mpgHighway = 26.8;
// Calculate distance in city
Distance = Tankcapacity * mpgCity;
//Output results for city
cout << "The car can travel " << Distance << " miles in the city." << endl;
// Calculate distance in highway
Distance = Tankcapacity * mpgHighway;
//Output results for highway
cout << "The car can travel " << Distance << " miles on the highway." << endl;
return 0;
}