Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

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.

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions