Question
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.
--The DebugFive2 class compiles without error.
--The DebugFive2 logic errors have been fixed.
--The DebugFive2 program accepts user input and displays the correct output.
An example of the program is shown below:
Enter a number 10 Enter another number 3 Neither of these numbers is evenly divisible into the other
CODE:
// DebugFive2.java
// Decides if two numbers are evenly divisible
import java.util.Scanner;
public class DebugFive2
{
public static void main(String args[])
{
int num;
int num2;
Scanner input = new Scanner(System.in);
System.out.print("Enter a number ");
num = input.nextInt;
System.out.print("Enter another number ");
num2 = input.nextInt;
if((num % num2 == 0) && (num2 / num) == 0)
{
System.out.println("One of these numbers is");
System.out.println(" evenly divisible into the other");
}
else
{ System.out.println("Neither of these numbers is");
System.out.println(" evenly divisible into the other");
}
}
}
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