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 01:00
What is added to the < meta > tag to describe the encoding type?
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
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
Mathematics, 20.10.2020 20:01
question
English, 20.10.2020 20:01
question
Mathematics, 20.10.2020 20:01
question
Mathematics, 20.10.2020 20:01
question
Mathematics, 20.10.2020 20:01
question
Social Studies, 20.10.2020 20:01