output of this java program is slightly off?
<p><strong>Java Code:</strong></p>

<pre><code>public class Car {

    //variables
    int myStartMiles;
    int myEndMiles;
    double myGallonsUsed;
    int odometerReading;
    double gallons;

    //constructors
    public Car(int odometerReading) {
        this.myStartMiles = odometerReading;
        this.myEndMiles = myStartMiles;
    }

    //methods
    public void fillUp(int odometerReading, double gallons) {
        this.myEndMiles = odometerReading;
        this.gallons = gallons;
    }

    public double calculateMPG() {
        int a = (this.myEndMiles - this.myStartMiles);
        return ((a) / (this.gallons));
    }

    public void resetMPG() {
        myGallonsUsed = 0;
        this.myStartMiles = myEndMiles;
    }

    public static void main(String[] args) {
        int startMiles = 15;
        Car auto = new Car(startMiles);

        System.out.println("New car odometer reading: " + startMiles);
        auto.fillUp(150, 8);
        System.out.println("Miles per gallon: " + auto.calculateMPG());
        System.out.println("Miles per gallon: " + auto.calculateMPG());
        auto.resetMPG();
        auto.fillUp(350, 10);
        auto.fillUp(450, 20);
        System.out.println("Miles per gallon: " + auto.calculateMPG());
        auto.resetMPG();
        auto.fillUp(603, 25.5);
        System.out.println("Miles per gallon: " + auto.calculateMPG()); 
    }
}
</code></pre>

<p>I'm trying to get this to work, but I can't get the desired output.</p>

<p>The desired results are:</p>

<pre><code>New car odometer reading: 15
Miles per gallon: 16.875
Miles per gallon: 16.875
Miles per gallon: 10.0
Miles per gallon: 6.0
</code></pre>

<p>I'm getting:</p>

<pre><code>New car odometer reading: 15
Miles per gallon: 16.875
Miles per gallon: 16.875
Miles per gallon: 15.0
Miles per gallon: 6.0
</code></pre>

<p>Could you tell me what is wrong with the code? I am trying to manually run it by hand on paper.</p>
