Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fix all compilation errorsfor this JAVA program // // Debugging Problem import j

ID: 3672420 • Letter: F

Question

Fix all compilation errorsfor this JAVA program

//
// Debugging Problem
import java.util.Scanner;

public class Temperature
{
   public static void main( String args[] )
   {
      int option;
      int degree1;
      int celsius1;
      int fahrenheit1;  
         
      Scanner input = new Scanner( System.in );

      option = 0;

      While ( option != 3 )
     
         System.out.printf( "%s %s %s ", "1 for Fahrenheit to Celsius",
            "2 for Celsius to Fahrenheit", "3 to quit:" );
         option = input.nextDouble();
         
         System.out.println( "Enter the degrees in Fahrenheit: " );
         degree1 = input.nextDouble();
    
         celsius1 = ( degree1 - 32 ) * 5 / 9;
         System.out.printf( "The temp in Celsius is %d ", celsius1 );
         
         if ( option == 2 );
    
            System.out.println( "Enter the degrees in Celsius: " );
            degree1 = input.nextDouble();
    
            fahrenheit1 = ( degree1 * 9 / 5 ) + 32;
            System.out.printf( "The temp in Fahrenheit is %d ", fahrenheit1 );
      } // end while loop
   } // end method Main
} // end class Temperature

Explanation / Answer

// Debugging Problem
import java.util.Scanner;
public class Temperature
{
public static void main( String args[] )
{
int option;
Double degree1;
Double celsius1;
Double fahrenheit1;

Scanner input = new Scanner( System.in );
option = 0;

while ( option != 3 ){

System.out.printf( "%s %s %s ", "1 for Fahrenheit to Celsius",
"2 for Celsius to Fahrenheit", "3 to quit:" );
option = input.nextInt();

System.out.println( "Enter the degrees in Fahrenheit: " );
degree1 = input.nextDouble();
  
celsius1 = ( degree1 - 32 ) * 5 / 9;
System.out.printf( "The temp in Celsius is %d ", celsius1 );

if ( option == 2 );
  
System.out.println( "Enter the degrees in Celsius: " );
degree1 = input.nextDouble();
  
fahrenheit1 = ( degree1 * 9 / 5 ) + 32;
System.out.printf( "The temp in Fahrenheit is %d ", fahrenheit1 );
} // end while loop
} // end method Main
} // end class Temperature

Changes:

int degree1;
      int celsius1;
      int fahrenheit1;

Double degree1;
Double celsius1;
Double fahrenheit1;

While ( option != 3 )

while ( option != 3 ){