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 DebugFive3 class compiles without error.
-- The DebugFive3 program accepts user input and displays the correct output.
An example of the program is shown below:
Please enter item number >> 439 Valid - Item in Automotive Department
CODE:
import java.util.Scanner;
public class DebugFive3
{
public static void main (String args[])
{
int item;
String output;
final int LOW = 111;
final int HIGH = 999;
final int CUTOFF = 500;
Scanner input = new Scanner(System.in);
System.out.print("Please enter item number >> ");
item = input.nextInt();
if(item > LOW)
output = "Item number too low";
else
if(item >= HIGHH)
output = "Item number too high";
else
if(item == CUTOFF)
output = "Valid - Item in Automotive Department";
else
output = "Valid - Item in Housewares Department";
System.out.println(output);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started