subject

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.

// Displays five random numbers between
// (and including) user-specified values
import java. util. Scanner;
public class DebugSix4
{
public static void main(String[] args)
{
int high, low, count = 0;
final int NUM = 5;
Scanner input = new Scanner(System. in);
System. out. print("This application displays " + NUM +
" random numbers" +
"\nbetween the low and high values you enter" +
"\nEnter low value now... ");
low = input. nextInt()
System. out. print("Enter high value... ");
high = inputnextInt();
while(low < high)
{
System. out. println("The number you entered for a high number, " +
high + ", is not more than " + low);
System. out. print("Enter a number higher than " + low + "... ");
high = input. nextInt();

while(count < NUM)
{
double result = Math. random();
int answer = (int) (result * 10 + low);
if(answer <= higher)
{
System. out. print(answer + " ");
++count;
}
}
System. out. println("End of Application");
}
}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:00, pinkyglitter2696
Give an example of a case where a two-way handshake to establish a connection could leave one side of the connection live while the other side does not believe there is a connection.
Answers: 1
image
Computers and Technology, 22.06.2019 05:20, ashcormu11
Write a program called assignment3 (saved in a file assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b. c. it is a simple but very e↵ective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the “larger” integer is replaced by the di↵erence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
image
Computers and Technology, 22.06.2019 06:30, gracie2492
What result from the passage of this amendment
Answers: 1
image
Computers and Technology, 22.06.2019 14:30, chaparro0512
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
You know the right answer?
The files provided in the code editor to the right contain syntax and/or logic errors. In each case,...

Questions in other subjects:

Konu
Mathematics, 19.10.2020 01:01
Konu
Mathematics, 19.10.2020 01:01