subject

You will use conditionals, loops, and functions to implement a trigonometric functions calculator. THE PROBLEM
You must complete the provided Python program to calculate three trigonometric functions based on the user's input. The user can select the following trigonometric functions: 1. Sine, 2. Cosine, and 3. Tangent. The user will input option 4 to exit the program. If the user inputs a number different than 1, 2, 3, or 4, your program must print into the display the following message: Invalid option. Your program will keep asking the user for an option until the user choice is 4 (exit).
Trigonometric functions:
Sine: to calculate the sine of an angle (in radians), you must use the following Maclaurin series (Wikipedia):
sin(x) = ∑[infinity]n=0(−1)nx2n+1(2n+1)!∑n=0 [infinity](−1)nx2n+1(2n+1)!
Where x is the value of the angle in radians.
Cosine: to calculate the cosine of an angle (in radians), you must use the following Maclaurin series (Wikipedia):
cos(x) = ∑[infinity]n=0(−1)nx2n(2n)!∑n=0[inf inity](−1)nx2n(2n)!
Tangent: For the value of an angle different than 90 or 270 (in degrees), the tangent is:
tan(x) = sin(x)cos(x)sin(x)cos(x)
Where x is the value of the angle in radians.
User-defined Functions:
You must write the definition of the following functions:
factorial: this function receives as a parameter an integer value and returns the factorial of the received value. For a parameter equal to 5, the function returns 120 (5 * 4 * 3 * 2 * 1).
sin: this function receives two parameters (a float representing the value of the angle in radians and an integer value representing the number of terms of the Maclaurin series to be calculated). The function returns the value of the sine of the first parameter calculated with the first n terms of the Maclaurin series for the sine (where n is the second parameter received by the function).
cos: this function receives two parameters (a float representing the value of the angle in radians and an integer value representing the number of terms of the Maclaurin series to be calculated). The function returns the value of the cosine of the first parameter calculated with the first n terms of the Maclaurin series for the cosine (where n is the second parameter received by the function).
degTorad (provided): this function receives as a parameter an integer value representing an angle in degrees and returns the value of the received angle in radians.
printMenu (provided): this function does not receive parameters and does not return a value. The function prints the to STDOUT (display) the menu to be used by the user.
Main program:
The main program is provided in the template file. Please use the comments in the template file to complete your solution.
Input:
Your program takes as initial input one integer value representing the menu option. If the initial input value is a trigonometric function (1, 2, or 3), the program will request two additional inputs (an integer value representing an angle in degrees and the number of terms used in the Maclaurin series). The input statements are provided in the template file.
Output:
The print statements are provided in the template file (do not modify the output messages).
Note:
You can safely assume that the input will always be valid.
Example :
THE TRIGONOMETRIC CALCULATOR
1 - Calculate the sine of a value
2 - Calculate the cosine of a value
3 - Calculate the tangent of a value
4 - Exit
Enter your option: 1
Enter the value (in degrees): 45
Enter the number of terms: 10
The sine of 45 is 0.7071
THE TRIGONOMETRIC CALCULATOR
1 - Calculate the sine of a value
2 - Calculate the cosine of a value
3 - Calculate the tangent of a value
4 - Exit
Enter your option: 2
Enter the value (in degrees): 45
Enter the number of terms: 10
The cosine of 45 is 0.7071
THE TRIGONOMETRIC CALCULATOR
1 - Calculate the sine of a value
2 - Calculate the cosine of a value
3 - Calculate the tangent of a value
4 - Exit
Enter your option: 3
Enter the value (in degrees): 45
Enter the number of terms: 10
The tangent of 45 is 1.0000
THE TRIGONOMETRIC CALCULATOR
1 - Calculate the sine of a value
2 - Calculate the cosine of a value
3 - Calculate the tangent of a value
4 - Exit
Enter your option: 4

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:00, SoccerHalo
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
image
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
image
Computers and Technology, 22.06.2019 23:00, brooklynmikestovgphx
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
image
Computers and Technology, 23.06.2019 05:00, sharkboy578
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
You know the right answer?
You will use conditionals, loops, and functions to implement a trigonometric functions calculator....

Questions in other subjects:

Konu
Advanced Placement (AP), 22.07.2019 13:00
Konu
Physics, 22.07.2019 13:00