Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Unit 5: Debugging Exercise 5-2 Instructions DebugFive2.java X + 1 / / DebugFive2 . java The files provided in the code editor to the right
Unit 5: Debugging Exercise 5-2 Instructions DebugFive2.java X + 1 / / DebugFive2 . java The files provided in the code editor to the right contain 2 / / Decides if two numbers are evenly divisible 3 import java . util . Scanner; syntax and/or logic errors. In each case, determine and fix 4 public class DebugFive2 the problem, remove all syntax and coding errors, and run 5 { > the program to ensure it works properly. 6 public static void main(String args) 7 8 An example of the program is shown below: int num; 9 int num2; 10 Scanner input = new Scanner (System. in) ; 11 System. out . print( "Enter a number ") ; Enter a number 10 12 num = input . nextInt; Enter another number 3 13 System . out . print("Enter another number ") ; Neither of these numbers is 14 num2 = input . nextInt; evenly divisible into the other 15 if ( (num % num2 == 0) && (num2 / num) == 0) 16 17 System. out . printIn( "One of these numbers is"); Tasks 18 System. out . printIn(" evenly divisible into the other" ) ; 19 The DebugFive2 class compiles without error. 20 else 21 System. out . printIn( "Neither of these numbers is") ; 22 System. out . printIn(" evenly divisible into the other"); O The DebugFive2 logic errors have been fixed. > 23 24 O 25 } The DebugFive2 program accepts user input > 26 and displays the correct 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