Hey guys:
I've been struggling all day to make a chart that converts temperatures from Fahrenheit to Celsius. I figured out how to set up the entire program and display it on the console by using the for loop, but my professors wants it to be displayed in a joptionpane. How can you set up a loop within the joptionpane? This is what I have set up, but it just gives me one temperature conversion per dialog box. Any help would be greatly appreciated!!!
package fahrenheitToCelcius;
import javax.swing.JOptionPane;
public class Temperature
{
public static void main(String[ ] args)
{
// Generate values for both temperatures.
for (int fahrenheit = 0; fahrenheit <= 250; fahrenheit += 10)
{
double celsius = (1.8) * (fahrenheit -32);
JOptionPane.showMessageDialog(null, fahrenheit + "F " + " " + celsius + "C\n", "Fahrenheit to Celsius", JOptionPane.INFORMATION_MESSAGE);
}
}
}
Also, I need to have the temperatures below freezing in blue font and the temperatures above boiling in red. How would I do that?