Heres how i did it.. Would you guys do the same?
*/
import javax.swing.*;
public class Temperature2 {
public static void main (String [] args) {
// Declare variables here
String userInput; //In celsius, input of temperature
int temperature1; //integar
final int WINTER_TIME = -15;
userInput = JOptionPane.showInputDialog(null,"Enter the temperature in celsius") ;
temperature1 = Integer.parseInt(userInput);
if (WINTER_TIME < temperature1); //if the temperature input is below -15 degrees
System.out.println("Put on shorts and a light jacket"); //The print the following
// all done, exit
System.out.println("\nEnd of processing.");
}// main
}// Temperature2
Hey Everyone, How would you program this in simple way?
I am trying to Create a program that Asks the user, via JOptionPane, to input a temperature value in Celsius and Convert this value
to an integer. i also want it to Check if the temperature is below -15 degrees. (Use a constant to store this value.) If so,
instruct the user to change out of their shorts and put on a light jacket.
How would you program this?
(new to programming)
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.