Question: need help to debug this- and can you please explain it to me, too? // DebugFive4.java // Outputs highest of four numbers import java.util.*; public
// DebugFive4.java
// Outputs highest of four numbers
import java.util.*;
public class DebugFive4
{
public static void main (String args[])
{
Scanner input = new Scanner(System.in);
int one, two, three, four;
String str, output;
System.out.println("Enter an integer");
str = input.next();
one = Integer.parseInt(str);
System.out.println("Enter an integer");
str = input.next();
two = Integer.parseInt(str);
System.out.println("Enter an integer");
str = input.next();
three = Integer.parseInt(str);
System.out.println("Enter an integer");
str = input.next();
four = Integer.parseInt(str);
if(one > two > one > three > one > four)
output = "Highest is " + four;
else
if(two > one && two > three !! two > four)
output = "Highest is " + three;
else
if(three > one && three > two && three > four)
output = "Highest is " + three;
else
output = "Highest is " + four;
System.out.println(output);
}
}
Instructions The fie provided in the code edinor to the right containt syntax and/or logic ertors. In each case. determine and tix the peoblem, remove all syntax and coding errors and run the pregram to ensure it works properly Grading Write your Java code in the avea on the right. Use the Mun button to compie and fun the esde. Clicking the Run Cheeks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your rebults elick the Submit button to recard yout soore
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
