Using Java, write a computer program that solves the following problem:Assume that the radius of this circle is 1.) First, generate a series of random points as simple (x, y) coordinates. These points...

Using Java, write a computer program that solves the following problem:Assume that the radius of this circle is 1.) First, generate a series of random points as simple (x, y) coordinates. These points must fall within the Cartesian coordinates that bound the square. Of the total number of random points that are generated, some will occur within the circle. Next, estimate p by performing the following calculation:p = 4× (number of points in circle) / (total number of points)Write a multithreaded version of this algorithm that creates several threads (8 threads), each of which generates random points (12,500,000 points) and determines if the points fall within the circle. Each thread will have to update the global count of all points that fall within the circle. Protect against race conditions on updates to the shared global variable by using mutex locks. When all threads have exited, the parent thread will calculate and output the estimated value of p. It is worth experimenting with the number of random points generated. As a general rule, the greater the number of points, the closer the approximation to p.

May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here