Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1: Create a new source file called degreesToRadians.cpp to create and test function called degreesToRadians(x). Please use the following function prototype: double degreesToRadians(double angle_in_degrees);

Task 1: Create a new source file called degreesToRadians.cpp to create and test function called degreesToRadians(x). Please use the following function prototype: double degreesToRadians(double angle_in_degrees); Note: For PI, add the following above int main(){ const double PI = atan(1.0)*4.0; // PI is a global constant The degreesToRadians function will take double as a parameter and return a double as a value. You should verify with hand calculations and cin/cout statements in main() that your function is producing the correct results for sample test values in the range of 0 to 2Pi (0 to 360 degrees). Please include these results in the comments section of your .cpp source file. Note that if an input degree has range out of 0 to 360 degrees, e.g., -45 degree or 400 degrees, you must first convert it into the range of 0 to 360 degrees. Task 2: Create a new source file called factorial.cpp to create and test factorial(x) function. You should verify with hand calculations and cin/cout statements in main() that your function is producing the correct results for test input values in the range of 0 to 10. See sample output below for details. The factorial function will take double as a parameter and return a double value which corresponds to the following prototype: double factorial(double factorial); Task 3: Create a new source file called taylorSeries.cpp so you can create and test a Taylor Series version of the Sine(angle_in_radians) function. Call your function mySine(angle_in_radians) which takes a double as a parameter and returns a double as a result. The input to this function is in radians. You will need to copy the functions from Task 1 and Task 2 to this new source file. Implement the Taylor Series for the Sine function using a loop. The mySine() function compares the previous calculated Sine to the current calculated value of Sine. Once the difference between these two values is within the error (0.00001) indicated in the specification, the value should be returned to the calling function. Note: Make sure to create a function prototype for mySine() and place it above main() Task 4: Update the file called taylorSeries.cpp so you can create and test a Taylor Series version of the Cosine(angle_in_radians) function. The input to this function is in radians. This function should be called myCosine(x) and take one double as a parameter and return a double as a result. You should use the mySine() function above as a model. Note: Make sure to create a function prototype for myCosine() and place it above main() Task 5 Finally, create a table using a loop from -45 to 540 degrees in steps of 15 containing the following: Angle in degrees Angle in radians Your Trigonometric functions Please see the sample output below for output formatting details.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions