Final


Write a program that asks the user to Enter 1 to compute Taylor series for e, 2 to prompt the user for a sequence of numbers, and 3 to quit. Use a switch to handle the following cases
  1. If the user enters 1, you will compute the Taylor series for e^x and output the result. That is:
    1+x+(x^2)/2!+(x^3)/3!+(x^4)/4!+...
    (Recall n!=n(n-1)(n-2)...(2)(1).) So the user will get two prompts: 1 for the exponent x, and one for the degree of the series (how many terms of the sum to compute). Use a double for x and an integer for the degree. So, if the user enters 2 for x and 3 for the degree, you'll compute
    1+2+4/2!+8/3!
    Write one function that computes the factorial and a second that computes a given term of the sum. Place the invocation of these functions in a count controlled for-loop that is controlled by the degree entered by the user.
  2. If the user enters 2, prompt the user for a sequence of numbers, then write a message to the user expressing your feeling about the second number of the sequence. You should store the sequence in an array of maximum length 50. So if the user enters 2, 5, 4, 6, you output should say: The number 5 is my favorite. Use a function to initialize the array and get the number from the user.
  3. If the user enters 3, the program should quit. That is, do nothing.

Here's some sample runs of the program. If the user enters 1:
Enter 1 to compute Taylor series, 2 to say something about Jon, and 3 to quit: 1
Enter the exponent on e: 1
Enter the degree of the Taylor polynomial: 7
2.71825
Here's what should happen if the user enters 2:
Enter 1 to compute Taylor series for e, 2 to play a stupid number game, and 3 to quit: 2
You will enter up to 50 positive integers.  Hit enter after each.  When finished enter a negative number.
Enter integer number 1:9
Enter integer number 2:7
Enter integer number 3:33
Enter integer number 4:9875
Enter integer number 5:-1
The number 7 is my favorite.
If the user enters 3 the program should just quit:
Enter 1 to compute Taylor series for e, 2 to say something about Jon, and 3 to quit: 3

Save your file as final.cpp.