Vehicle Object Class

 

public class Vehicle {

// The vehicle class has two fields/instance variable and they are:
private String make;
private int milesPerGallon;

// The following is the default constructor
public Vehicle() {

}

// mutator/setter methods
public void setMake(String m){
make = m;
}

public void setMilesPerGallon(int mpg){
milesPerGallon = mpg;
}

// accessor/getter methods:

public String getMake(){
return make;
}

public int getMilesPerGallon(){
return milesPerGallon;
}

}