I am currently a begining Java student and have some code for someone here to look at. Now according to the NetBeans program I am using to write this code there are no errors, but when I run the code I get "Exception in thread "main" java.util.IllegalFormatConversionException: f != java.lang.Integer"
Here is the code I have so far:
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int totalMiles = 0;
int totalGallons = 0;
int avgMiles = 0;
Scanner input = new Scanner(System.in);
while (totalMiles != -1)
{
System.out.print("How many miles: ");
totalMiles = input.nextInt();
if (totalMiles != -1)
{
System.out.print("How Many Gallons: ");
totalGallons = input.nextInt();
avgMiles = (totalMiles / totalGallons);
System.out.printf("Your average mileage is: %f\n",avgMiles);
}
}
}
}