Computers and Technology

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();
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Akkenson17871
The "instance" relationship shows that something is an object of a
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, toolazytobehuman
Me and category do i put them in because this is science
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, maddi0132
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
Do you know the correct answer?
What does this program do?
what is the program output if the user enters 1 when prompted for...

Questions in other subjects:

Konu
Chemistry, 17.02.2021 05:10
Konu
Mathematics, 17.02.2021 05:10
Konu
Mathematics, 17.02.2021 05:10
Konu
Mathematics, 17.02.2021 05:10