(Assignment) I Am Lost

As written, the program design requires sentinel controlled repitition. This should be the second program that you write.

For the first program, assume that there are exactly 6 miles driven/gallons sets of input. This will require counter-controlled repetition.

OK, this is all I got so far. I know it looks stupid, but any help in the 1st part would be deeply appreciated.

import.java.util.Scanner;

public class MPG

{

Scanner input = new Scanner( System.in );

int gallons;

int tank;

int miles;

double avg;

double avg_all

total = 0;

counter = 1;

while ( counter <= 6 )

{

System.out.print( "Enter gallons: " );

gallons = input.nextInt();

System.out.print( "Enter miles: " );

miles = input.nextInt();

}

average = total \ 6;

System.out.printf( "\nTotal of all 6 tanks is %d\n", total );

System.out.printf( "average mpg

[964 byte] By [wldctj8a] at [2007-10-3 7:50:16]
# 1

When posting code use code tags (paste your code, highlight it and click code button).

It's usually a good idea to tell us what the problem is. Compile error? Paste the entire error message. Wrong output? Tell us the desired output and the actual output.

average = total \ 6;

For now, look at your code and tell me what the value of total will be in the above line of code.

floundera at 2007-7-15 2:52:07 > top of Java-index,Java Essentials,New To Java...