I am new to java programming. I was trying to write a code that convert temperature from Fahrenheit to Celsius or vice versa , and I am getting reached end of the file while parsing error . so what should I do to fix it
package fahrenheittocelsius;
import java.util.Scanner;
public class Fahrenheittocelsius
{
public static void main(String[] args)
{
String firstchoice ;
String ftc ="fahrenheit to celsuis" ;
String ctf = "celsius to fahrenheit";
System.out.println("Do you want to convert from 'fahrenheit to celsuis' or 'celsius to fahrenheit' ");
Scanner firstscan = new Scanner(System.in);
firstchoice = firstscan.nextLine();
if (firstchoice.equals(ftc) );
{
System.out.println("Write in the temperature in Fahrenheit that you want to convert it to celsius ");
Scanner scan1 = new Scanner(System.in);
double f ;
f = scan1.nextDouble();
double c ;
c= (5/9.0)* (f-23) ;
System.out.println("the temperature in celsius is " + c );
}
if (firstchoice.equals(ctf) );
{
System.out.println("Write in the temperature in celsuis that you want to convert it to fahrenheit ");
Scanner scan2 = new Scanner(System.in);
double CC ;
double FF ;
CC = scan2.nextDouble();
FF= (CC * 2) + 30 ;
System.out.println("the temperature in celsius is " + FF);
}
}
}
. If you formatted your code pleasantly, you'd find that easy to spot. If you're not using an IDE or an editor which can format your code for you, indenting it appropriately, I suggest you start right now.{
and figure out where the}
should go.