Can someone lead me in the right direction or help me figure out why it's giving me the error of "100.0Exception in thread "main" 310.93 degrees in Fahrenheit isjava.util.MissingFormatArgumentException: Format specifier '%7.2f'? I'm a beginner in Java and can't seem to find a fix for this issue.
public static void main(String[] args) {
// Below this comment: declare and instantiate a Scanner
// Below this comment: declare any other variables you may need
// to store the user's input and the Kelvin equivalent value
// Below this comment: collect the requried inputs from the user
System.out.println("Enter temperature in Fahrenheit : ");
Scanner scan = new Scanner(System.in);
float fahr = scan.nextFloat();
// Below this comment: call your FahrenheitToKelvin method
FahrenheitToKelvin(fahr);
// Below this comment: disply the required results
System.out.printf(fahr + "%.2f" + " degrees in Fahrenheit is%7.2f", FahrenheitToKelvin(fahr));
System.out.printf(" degrees in Kelvin. ");
}
// define your FahrenheitToKelvin method here below
public static float FahrenheitToKelvin(float fahr) {
float kelv = (float) ((fahr - 32) * 5/9 + 273.15);
return kelv;
}
}