Question
The file provided in the code editor to the right contains syntax and/or logic errors. In each case, determine and fix the problem, remove all
The file provided in the code editor to the right contains 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. Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.
// DebugSix3.java
// Prompt user for value to start
// Value must be between 1 and 20 inclusive
// At command line, count down to blastoff
// With a brief pause between each displayed value
import javax.util.*;
public class DebugSix3
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String userNumString;
int userNum, val;
final int MIN = 1;
final int MAX = 20;
userNumString = JOptionPane.showInputDialog(null, "Enter a number between " + MIN + " and " + MAX + " inclusive");
userNum = Integer.parseInt(userNumString);
while (userNum < MIN || userNum > MAX)
{
userNumString = JOptionPane.showInputDialog(null,
"Number out of range" +
" Enter a number between " + MIN + " and " + MAX + " inclusive");
}
for(val = userNum; val > 0; --val)
{
System.out.print(val + " ");
for (int x = 0; x < 100000; ++x)
for(int y = 0; y < 10000; ++y)
}
System.out.println("Blastoff!");
}
}
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