3 minor errors closing my program...

I am having a hard time resolving these errors :

tempconversion.java:41: error: <identifier> expected
   System.out.println ( "Good Bye " ) ;
                     ^
tempconversion.java:41: error: illegal start of type
   System.out.println ( "Good Bye " ) ;
                        ^
tempconversion.java:45: error: class, interface, or enum expected
}
^
3 errors

This is the program:


//converts temperatures from centigrade to farenheit and vice versa using manuel input from the user

import java.util.Scanner; //I like to use this input to import a scanner as opposed to using the asterisk

public class tempconversion
{
   public static void main (String[] args)
   {
   Scanner stdin = new Scanner (System.in) ;
   Scanner F2C = new Scanner (System.in) ;
          
   System.out.println ( "If you are converting F ==> C press 0 " ) ;
   System.out.println ( "If you are converting C ==> F press 1 " ) ;
   F2C.nextDouble() ; 
      
   if( F2C == 0){
      
   while (stdin.hasnext () )   {
      System.out.println ( "Enter next input : " );
      stdin.nextDouble () ;
      tC= ((stdin * 9.0)/ 5.0)+ 32.0 ; 
      System.out.println( " Input : " + (stdin.nextDouble));
      System.out.println ( "Converted : " + ( tC )) ;
   
   }
   } else {
      
   while (stdin.hasnext () )   {
      System.out.println ( "Enter next input : " );
      stdin.nextDouble () ;
      tF= ((stdin - 32.0) * 5.0) / 9.0 ; 
      System.out.println( " Input : " + (stdin.nextDouble));
      System.out.println ( "Converted : " + ( tF )); }
   
   }

   
   } 
   System.out.println ( "Good Bye " ) ; 
      
   }
   
}

Open in new window

aminkeithAsked:
Who is Participating?
 
mccarlConnect With a Mentor IT Business Systems Analyst / Software DeveloperCommented:
Remove the   }   from line 38 of the code that you posted above, and the errors should be resolved.
0
 
n2fcCommented:
Too many close brackets...

This line has the extra:
    System.out.println ( "Converted : " + ( tF )); }

Try using something like lint to catch these typos!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.