Question: Debug the code provided in the starter file. This program is supposed to print Ratio OK if the ratio of two integers entered by

Debug the code provided in the starter file. This program is supposed

Debug the code provided in the starter file. This program is supposed to print "Ratio OK" if the ratio of two integers entered by the user is between 1 exclusive and 8 inclusive (i.e. if the first divided by the second is greater than 1 and less than or equal to 8). The debugged code should not produce any error messages as long as two integers are entered by the user. Although the program asks the user to scan in two integer values using the nextInt() method, make sure to declare one variable as a double so the ratio of the two integers will produce a double result instead of an integer result. Files U3_L5_Activity_One.java STATUS 12345678 /* Lesson 5 Coding Activity Question 1 */ 3 import java.util.Scanner; 5 public class U3_L5_Activity_One 6 - { 8- 9 10 11 NOT SUBMITTED 12 13 14 15 16 17 18 19 18 } public static void main(String[] args) { } Scanner scan = new Scanner(System.in); System.out.println("Enter 2 integers:"); int x = scan.nextInt(); scan.nextDouble(); int y if(x/y < 8 && x != 0) System.out.println("Ratio OK"); SAVE SUBMIT V= V= INSTRUCTIONS RUN CODE GRADING KX KY HISTORY Debug the code provided in the starter file. This program is supposed to print "Ratio OK" if the ratio of two integers entered by the user is between 1 exclusive and 8 inclusive (i.e. if the first divided by the second is greater than 1 and less than or equal to 8). The debugged code should not produce any error messages as long as two integers are entered by the user. Although the program asks the user to scan in two integer values using the nextInt() method, make sure to declare one variable as a double so the ratio of the two integers will produce a double result instead of an integer result.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Corrected code with debugging java import javautilScanner public class U3L5Acti... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!