2
Write a program that given two temperatures in Fahrenheit degrees (integer values) produces a table with all values in this interval of half degree Fahrenheit. For example, the execution of the program for values 30 and 35 should produce the following output:
Enter spaced interval values (min max):
30
35
Fahrenheit Celsius
30.00 -1.11
30.50 -0.83
31.00 -0.56
31.50 -0.28
32.00 0.00
32.50 0.28
33.00 0.56
33.50 0.83
34.00 1.11
34.50 1.39
35.00 1.67
And I leave my code there, but after I insert the maximum the program gives the error:
java.util.Illegalformatconversionexception: f != java.lang.String
public static void main(String[] args)
{
System . out . println("Por favor indique um valor minimo:");
int min = scanner.nextInt();
System.out.println("Agora indique um valor máximo:");
int max = scanner.nextInt();
double celsius = (min-32*(5/9));
int i = 0;
min++;
for (i=0; max + 1 > min;min++)
{
System.out.printf("%6.2f\t\t%6.2f\n","Fahrenheit" + min + " Celsius " + celsius);
}
}
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero