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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
question
Computers and Technology, 24.06.2019 22:30
To add additional commands to the quick access toolbar, a user can navigate to the view. backstage status bar design file
Answers: 2
question
Computers and Technology, 25.06.2019 02:00
Lisa is making a presentation for her project and she wants to use the logo of her company in her presentation. which element would she use to make her logo stand out in her presentation? a. gradation b. contrast c. alignment d. balance
Answers: 1
You know the right answer?
You will use conditionals, loops, and functions to implement a trigonometric functions calculator....
Questions
question
Biology, 20.09.2020 17:01
question
Mathematics, 20.09.2020 17:01
question
Business, 20.09.2020 17:01
Questions on the website: 13722363