Java BugHunt #5: If Statements

Difficulty: Easy
Time to solve: <5 min
Video this is covered in: 6



import java.util.Scanner;
public class Jtutorial1 {
    public static void main(String args[]){
    Scanner input = new Scanner(System.in);
        
    System.out.println("How much does Employee 1 make? ");
    double emp1 = input.nextDouble();
    
    System.out.println("How much does Employee 2 make? ");
    double emp2 = input.nextDouble();
    
    System.out.println("How much does Employee 3 make? ");
    double emp3 = input.nextDouble();    
    
    if (emp1 > emp2){
    if (emp1 > emp3){
        System.out.println("Employee 1 makes more than the other 2 employees");
    }
    else{
        System.out.println("Employee 3 makes more than Employee 1.");
    }
    else{
        System.out.println("Employee 2 makes more than employee 1");
    }
    
    
    }//end main
}//end class

Input:
500
400
300

Program Output:
How much does Employee 1 make?
How much does Employee 2 make?
How much does Employee 3 make?
Employee 1 makes more than the other 2 employees
Error information:Exception in thread “main” java.lang.RuntimeException: Uncompilable source code – ‘else’ without ‘if’
at Jtutorial1.main(Jtutorial1.java:22)