Answered step by step
Verified Expert Solution
Link Copied!

Question

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.

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

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

What is the Profitability ratios and how do you calculate it?

Answered: 1 week ago