Isiah K.

asked • 10/24/20

I need help debugging this code, I have tried multiple times and still am having trouble please help.

My assignment is to debug this code, however I am not sure about what I am doing wrong.



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);

}

}


Patrick B.

source code posted under this link... Bubble sorts the 4 integers
Report

10/24/20

2 Answers By Expert Tutors

By:

Patrick B. answered • 10/24/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.