import java.util.Scanner;
public class mk2
{
public static void main(String[] args)
{
new mk2 ();
Scanner input = new Scanner( System.in );
double total;
double gasCounter;
double gas = 0;
double average;
total = 0;
int valueCounter = 0;
System.out.print( " Enter gas price for octane 87, or -1 to quit: " );
double value = input.nextDouble();
while ( value != -1 )
{
total = total + value;
valueCounter = valueCounter + 1;
System.out.print( "Enter gas price for octane 89, or -1 to quit: " );
value = input.nextDouble();
while ( value != -1 )
{
total = total + value;
valueCounter = valueCounter + 1;
System.out.print( "Enter gas price for octane 91, or -1 to quit: " );
value = input.nextDouble();
}
if ( valueCounter != 0 )
{
if ( gas>=4.00)
{
total = (double) total;
}
else if(value<4.00)
{
total = (double) total;
}
else
{
System.out.println("enter the valid ones");
}
}
System.out.printf(" The average gas price is $%.3f\n", total/3);
}
}
}
public static void main(String[] args)
{
}