hi i have this assignment in which i am lost ... if someone could help me it would be great .... i dun need someone to write the program ... just some hints ... i will try to compile it myself ...

just let me know how would u do it

problem #1

Program the following simulation: Darts are thrown at random points onto a square with corners

(1, 1) and (−1, −1). If the dart lands inside the unit circle (that is, the circle with center (0, 0) and

radius 1), it is a hit. Otherwise it is a miss. Run this simulation and use it to determine an

approximate value for PI. Explain why this is a better method for estimating than the Buffon

needle program.

problem#2

Write a program that computes the approximate sine of an angle (θ) by using the following

infinite series:

Approximate sine of θ = θ – (θ3/3!) + (θ5/5!) - (θ7/7!) + (θ9/9!) … (other terms follow)

Where θ is in radians and the factorial computations are given as

3! = 3*2*1

5! = 5*4*3*2*1

7! = 7*6*5*4*3*2*1

9! = 9*8*7*6*5*4*3*2*1

…

N! = N*(N-1)*(N-2)…..*1

Of course, you can’t compute an infinite sum. Just keep adding values until an individual

summation term is less that a certain threshold.

For example, the equation below:

Approximate sine of θ = θ – (θ3/3!) + (θ5/5!) - (θ7/7!) + (θ9/9!)

computes the sin(θ) to 5 terms.

Also, use the C++ library function to compute the sine of theta (sin(θ)) and compute the Percent

Error between the approximate value of sine computed using the approximation and the sine

library function computation. The Percent Error formula is given below:

%error = ((1.0 – sin(θ))/approximate_sine_ θ)*100

Where sin(θ) is the C++ library function used for computing sine of an angle.