Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the header file Car.h for the Car class. The Car class has three data memb

ID: 3828551 • Letter: W

Question

Write the header file Car.h for the Car class. The Car class has three data members: miles_per_gallon (double), fuel (double), and model (string). The Car class has a constructor that initializes each data member. The Car class has four additional member functions:

get_model : no parameters, returns model

drive : double miles parameter, returns nothing

add_fuel : double gallons parameter, returns nothing

low_on_fuel : no parameters, returns true or false

Do not provide the implementation of the member functions.

Explanation / Answer

// Car.h

class Car
{
private:
double miles_per_gallon;
double fuel;
string model;

public:
Car(double a, double b, string c){ miles_per_gallon = a; fuel = b; model = c;}
string get_model();
void drive(double miles);
void add_fuel(double gallons);
bool low_on_fuel();

};