Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

import java.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;

System.out.println("Enter a number between " + MIN + " and " + MAX + " inclusive");

userNumString = input.next();

userNum = Integer.parseInt(userNumString);

while(userNum < MIN || userNum > MAX)

{

System.out.println("Number out of range" +

" Enter a number between " + MIN + " and " + MAX + " inclusive");

userNumString = input.next();

userNum = Integer.parseInt(userNumString);

}

for(val = userNum; val >= 1; --val)

{

System.out.print(val + " ");

try{

// sleep for 1 second

Thread.sleep(1000);

}

catch(InterruptedException e) {

e.printStackTrace();

}

// Adjust these numbers for faster or slower performance

}

System.out.println(" Blastoff!");

}

}

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

=+Could you use an ambient ad?

Answered: 1 week ago

Question

Discuss all branches of science

Answered: 1 week ago