Java mpg calculator total
<p>I have finished alot of the code. But now in the end i cant figure out how to get the totalMPG added from all the loops. Im really at a loss here with me limited experience with java.</p>

<pre><code>     //initialization phase
     double stop = 1;
     double miles = 0;
     double gallons = 0;
     double avgMPG = 0;
     double totalMPG = 0;
     double trip = 0;

    // if the user enters zero it will stop the loop
    while (stop != 0)
    {  
        System.out.print("Enter a number for miles traveled, or enter 0 to exit: ");
        miles = input.nextInt();

        if (miles == 0)
        {
            //took me a while to figure out where th break goes and {} placement
            break;
        }
        else
        {
            System.out.print("Enter number of gallons used: ");
            gallons = input.nextInt();
            avgMPG = miles/gallons;
            trip++;
            // i have tried multiple different ways to get totalMPG wont work
            totalMPG = mpg++ / trip++;
        }                              
    System.out.println("Your average MPG is " + avgMPG);
   }
    System.out.println("Your total trip MPG is " + totalMPG);

}
</code></pre>

<p>}</p>