Please help me find what I am doing wrong in this car class, codeHS.
public class Car {
private double efficiency;
private double gas;
private double tankCapacity;
private double totalMilesDriven;
public Car(double carEfficiency, double carTankCapacity)
{
efficiency = carEfficiency;
tankCapacity = carTankCapacity;
totalMilesDriven = 0;
gas = 0;
}
public void addGas()
{
gas = tankCapacity;
System.out.println("Filling up ...");
}
public void addGas(double amount)
{
if(gas + amount <= tankCapacity)
{
gas = gas + amount;
System.out.println("Adding gas ...");
}
else
{
System.out.println("Adding gas ...");
gas = tankCapacity;
}
}
public double getTotalMilesDriven()
{
return totalMilesDriven;
}
public void drive(double distance)
{
if(efficiency * gas >= distance)
{
System.out.println("Driving " + distance);
}
else
{
System.out.println("Can't drive " + distance + ". That's too far!");
}
}
public boolean canDrive (double distance)
{
if(gas > 0)
{
return true;
}
else{
return false;
}
}
public double milesAvailable()
{
double ma = efficiency * totalMilesDriven;
return ma;
}
public double getGas()
{
return gas;
}
}