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 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. what does it indicate when a website displays https instead of http? a. the website is secure. b. there is no secure sockets layer. c. the secure sockets layer is hidden. d. the website is not secure.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
question
Computers and Technology, 24.06.2019 02:50
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
You know the right answer?
What does this program do?
what is the program output if the user enters 1 when prompted for...
Questions
Questions on the website: 13722363