Archive for April 3rd, 2010

java help?

Saturday, April 3rd, 2010
ryan_macalinao5472 asked:


i keep getting this error “cannot find symbol constructor Car(int)” on driver.class

Car.class

public class Car {

int myStartMiles;
int myEndMiles;
double myGallonsUsed;

public void fillUp(int odometerReading, double gallons){

gallons = ++gallons;
odometerReading = ++odometerReading;
}

public double calculateMPG(){

double MilesPerGallon;
MilesPerGallon = (myEndMiles – myStartMiles) / myGallonsUsed;
return MilesPerGallon;

}

public double resetMPG(){

myStartMiles = (myEndMiles – myStartMiles);
myGallonsUsed = 0;
return myStartMiles;

}
}

driver.class

public class driver {

public static void main (String[] args){

Car auto = new Car(15);
System.out.println(“New car odometer reading: “);
auto.fillUp(150,8);
System.out.println(“Miles per gallon” + auto.calculateMPG());
System.out.println(“Miles per gallon” + auto.calculateMPG());
auto.resetMPG();
}
}

car.auto