subject

What does this program do?
what is the program output if the user enters 1 when prompted for the number of points?
how would your answer to the above question change if the test in line 15 used < = rather than < ?
print the homework or copy and paste the code below in your homework. draw a box around each statement, and underline each expression, in the code. (even though technically an assignment in java is an expression, do not underline entire assignments.)
the random component provides a pseudo-random number generator that generates numbers uniformly distributed in the [0.0,1.0) interval; the method call rnd. nextdouble() returns a pseudo-random number in the [0.0,1.0) interval. (in case you're not familiar with the notation here, [0.0,1.0) denotes an interval consisting of all real numbers between 0.0 inclusive and 1.0 exclusive, i. e., the set of all values x satisfying 0.0 ≤ x < 1.0.)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public static void main(string[] args) {
simplereader input = new simplereader1l();
simplewriter output = new simplewriter1l();
output. print("number of points: ");
int n = input. nextinteger();
int ptsininterval = 0, ptsinsubinterval = 0;
random rnd = new random1l();
while (ptsininterval < n) {
double x = rnd. nextdouble();
ptsininterval++;
if (x < 0.5) {
ptsinsubinterval++;
}
}
double estimate = (100.0 * ptsinsubinterval) / ptsininterval;
output. println("estimate of percentage: " + estimate + "%");
input. close();
output. close();
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Which of the following processes applications across multiple computing devices? a. functional application b. distributed system c. workgroup information silo d. information silo
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
Pseudocode pld #6, pg. 117 start// declarations// number numbertoguess// number myguess; numbertoguess = 92// while myguess ! = numbertoguess// output " guess an integer number between 1 and 100"// input myguess// if (myguess == numbertoguess)// output "you guessed the correct number"// else// output "the number you guessed was incorrect. try again! "// end if// end while// output " for playing the guessing game. have a great day! "// stop
Answers: 3
question
Computers and Technology, 25.06.2019 06:20
Horseback riders, bicyclists, and skateboarders the rules of right-of-way when they use the road ?
Answers: 1
You know the right answer?
What does this program do?
what is the program output if the user enters 1 when prompted for...
Questions
question
Business, 11.01.2020 19:31
question
Mathematics, 11.01.2020 19:31
Questions on the website: 13722362