Could someone please look at my ose and let me know where I may be going wrong. The problem to solve is define a class Odometer that will be used to track fueland mileage for an automobile. The class should have member variables to track the miles driven and the fuel efficiency of the vehicle in miles per gallon. Include a mutator function to reset the odometer to zero miles, and mutator function to set the fuel efficieny, a mutator function that acepts miles driven for a trip and adds it to the odometer's total, and an accessor method that returns the number oif gallons of gasoline that the vehicle has consumed sinced the odometer was last reset. I am getting one error :
Homework\Odometer.java:15: cannot find symbol
symbol : method setMPG(double)
location: class Odometer
first.setMPG(keyboard.nextDouble());
^
1 error
Tool completed with exit code 1
import java.util.Scanner;
public class Odometer {
public static void main(String args[]){
Odometer first = new Odometer();
Scanner keyboard = new Scanner(System.in);
System.out.println("How many miles did you drive?");
double miles1 = keyboard.nextDouble();
first.getMiles();
System.out.println("What is the MPG?");
first.setMPG(keyboard.nextDouble());
}
public int fuel, miles, MPG;
{
fuel = 0;
miles = 0;
MPG = 0;
}
public double getFuel()
{
fuel = 0;
return fuel;
}
public double getMiles()
{
miles = 0;
return miles;
}
public double getMPG()
{
MPG = 0;
return MPG;
}
}
Can someone please help me?:lol: