ANSWERS TO PRACTICE PROBLEMS // Problem 1. import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String inputString; int celsius, fahrenheit; inputString = JOptionPane.showInputDialog( "Enter a temperature in Celsius."); celsius = Integer.parseInt(inputString); fahrenheit = 9 * celsius / 5 + 32; System.out.println("The temperature in Fahrenheit is " + fahrenheit + " degrees."); } } // Problem 2. import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String inputString; int number, output; inputString = JOptionPane.showInputDialog( "Enter an integer number."); number = Integer.parseInt(inputString); output = number % 2; System.out.println("The output is " + output + "."); } }