Question: java the files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove
java
the files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
--The DebugFive4 class compiles without error.
--The DebugFive4 program accepts user input and displays the correct output.
An example of the program is shown below:
Enter an integer >> 6 Enter an integer >> 10 Enter an integer >> 3 Enter an integer >> 9 The highest number is 10
CODE:
import java.util.*;
public class DebugFive4
{
public static void main (String args[])
{
int one, two, three, four;
int highest;
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer >> ");
one = input.nextInt();
System.out.print("Enter an integer >> ");
one = input.nextInt();
System.out.print("Enter an integer >> ");
one = input.nextInt();
System.out.print("Enter an integer >> ");
one = input.nextInt();
if(one > two && one > three && one > four)
highest = one;
else
if(two > one && two > three || two > four)
highest = two;
else
if(three == one && three > two && three > four)
highest = three;
else
highest = four;
System.out.println("The highest number is " + highest);
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
