1. Implement a value returning function QUESTION1(N) to compute the error in the series approximation y = e^x = 1 + x + (x^2)/2! + (x^3)/3! + … up to m terms for a user defined integer value of m. Illustrate with x = 0.5 and m=6. The data types for x and y must be double. Each term in the series must be computed as a double. The exact value of the y must be computed using the exp() function from <math.h> <20 marks>
2. Implement a void function QUESTION2(a,b,c,d) that sorts four unique integers in ascending order. Illustrate with inputs a=10, b=4, c=7, d = 1. It is required that you first write functions mintwo(), maxtwo() as discussed in class to facilitate the sorting. <20 marks>
3. Implement the following value returning function QUESTION3() to estimate π. The function should first generate several random pairs of co-ordinates <x,y> where each coordinate is in the range [0,1]. For each such pair generated, it should evaluate whether the point denoted by <x,y> falls inside a unit circle (of which we are interested in the first quadrant only). Therefore it should compute the proportion P of points lying inside the circle. The function should return 4P, a quantity whose expected value is π = 3.14159265358
It is important that you set a fixed seed S (that governs the random number generation) and the fixed number N of points to be generated, and demonstrate that for these specific values your function computes π accurately up to TWO decimal places.
<20 marks>
4. Write a void function QUESTION4() that sorts in ascending order an array of size 10 using the bubble sort algorithm explained in class. Demonstrate the sorting by applying the function to an array that has been populated with values <10,9,8,7,6,5,4,3,2,1> which are values in the opposite (sorted descending) order. <20 marks>
Combine all the code for all the above questions and write it up as a single main program calling various functions QUESTION1, QUESTION2 etc. The program should be well documented (clear comments) and well designed (easy to understand flow of control, self-explanatory choice of variable names etc.) Submit a word or pdf document that shows for each question both the code and your demo (actual screenshots of outputs). <20 marks>