2.[30 points] Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in mile/gallon) and a certain amount of fuel in the gas tank (measured in by default.
(a)[1O points] Implement the constructor with two parameters. (b) [5 points] Implement member function add_gas(double x) that increment data memberfuel (c) [1O points] Implement member function drive(double y) that reduces the data member fuel (d) [5 points] Implement member function get_gas_level() to return the current fuel level.
#ifndef CAR H #define CAR H
class Car
public: //constructor Cardouble mpg = 28,double f=0;
void add gas(double x); //add x gallon of fuel into the gas tank //compute the amount of gas needed to drive y miles, and reduce that amount from the existing fuel amount //Assuming there is sufficient fuel to drive y miles void drive(double y);
//return the current fuel level double get_gas level() const;
private: double MPG; //miles per gallon double fuel; //amount of fuel in the gas tank };
#endif