Hello,
I'm new to java and I am trying to learn it as my first language and eventually move to Programming for Android. To get myself started for practice, I am working on a simple temperature conversion program. It is supposed to Ask the User for "C or F" (Celsius or Fahrenheit) Then if the reply was C, do the conversion, if F, convert to fahrenheit. If the user inputs anything else then give him/her an error. I keep getting errors on the code. First it was on the else code now it is on the if codes. Please help here is the code.
import java.util.Scanner; import java.io.*; public class converter { private static final boolean String = false; private static double sum; public static void main(String args[]) { Scanner scan = new Scanner(System.in); String usrInput; System.out.print("C or F: "); String usrInpt = scan.next(); if (String) usrInpt = "C" { Scanner temp = new Scanner(System.in); System.out.println("Temp: "); String celcius = scan.next(); double n = Double.parseDouble(celcius); double sum = ((n * 1.8) + 32); } if (String) usrInpt = "F" { System.out.println("Working on this"); } else { System.out.println("ERROR"); } System.out.println((double) sum); } }