Please help! I don't understand why I am getting this error: function does not take 0 arguments.
The program is suppose to calculate how much fuel is left in the tank after you drive a certain amount of miles.
Can someone please help explain why I am getting this error?
Thanks,
Dennis
#include <iostream>
#include <cmath>
using namespace std;
class Car
{
public:
Car();
void read();
void get_gas(double fuel_level);
void print() const;
private:
double fuel_efficiency;
double initial_fuel;
double fuel_level;
double distance;
};
Car::Car()
{
fuel_efficiency = 0;
fuel_level = 0;
distance = 0;
}
void Car::read()
{
cout << " \n *** Car Class Testing Program *** \n ";
cout << " Enter fuel efficiency in miles / per gallon: ";
cin >> fuel_efficiency;
cout << " How many gallons of fuel did you start with?: ";
cin >> initial_fuel;
cout << " How many miles will you be driving?: ";
cin >> distance;
}
void Car::get_gas(double fuel_level)
{
fuel_level = distance/fuel_efficiency - initial_fuel;
}
void Car::print() const
{
cout << "After the drive you will have ";
cout << fuel_level << " gallons of fuel left in the car";
}
int main()
{
Car my_car;
my_car.read();
my_car.get_gas();
my_car.print();
return 0;
}