Exercise #3, Functions Given a positive integer n and a floating point number x between 0.0 and 360.0. The objective of this exercise is to write a C++ program to compute the below math equations: 9(y, k) = P(y,k) f(k) ys y³ S(y,n) y- + 3! 5! We decompose the eqations into 5 simplified expressions as follows: 1. y = r(x) = x x π/180 2. p(y, k) = yk 3. f(k) = k! y=xxπ/180 y7 yº 7! 9! + where k is an integer smaller than or equal to n 4. 5. S(y,n)=y-q(y, 3) + q(y,5) -q(y, 7) + q(y, 9) -q(y, 11)+...+q(y,n) Write C++ functions to calculate each of the above expressions. In your main, you prompt the user to enter x and n, control the user input, then call function S(x, n) to compute expression 5. Function S(x, n) will call function r(x) to get y, then it calls other functions as needed to complete the computations and display your result at the end. e.g. Value of x: 30 Number of interations n: 12 S(30,12): 0.5 y11 yn + ± 11! n! Two other programmers calculated the above expression using different methods, in Method 1 (see below), the programmer used two loops, in Method 2 the programmer used one single loop. Method 1 int fact, sign=-1; float y = x*M_PI/180, p, sum = 0; for(int i=1;i
Exercise #3, Functions Given a positive integer n and a floating point number x between 0.0 and 360.0. The objective of this exercise is to write a C++ program to compute the below math equations: 9(y, k) = P(y,k) f(k) ys y³ S(y,n) y- + 3! 5! We decompose the eqations into 5 simplified expressions as follows: 1. y = r(x) = x x π/180 2. p(y, k) = yk 3. f(k) = k! y=xxπ/180 y7 yº 7! 9! + where k is an integer smaller than or equal to n 4. 5. S(y,n)=y-q(y, 3) + q(y,5) -q(y, 7) + q(y, 9) -q(y, 11)+...+q(y,n) Write C++ functions to calculate each of the above expressions. In your main, you prompt the user to enter x and n, control the user input, then call function S(x, n) to compute expression 5. Function S(x, n) will call function r(x) to get y, then it calls other functions as needed to complete the computations and display your result at the end. e.g. Value of x: 30 Number of interations n: 12 S(30,12): 0.5 y11 yn + ± 11! n! Two other programmers calculated the above expression using different methods, in Method 1 (see below), the programmer used two loops, in Method 2 the programmer used one single loop. Method 1 int fact, sign=-1; float y = x*M_PI/180, p, sum = 0; for(int i=1;i
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step 1: Introduction
VIEWStep 2: Source Code - My code
VIEWStep 3: Output - My code
VIEWStep 4: Proof that I have done it myself - My code
VIEWStep 5: Source Code - Method 1 and Method 2
VIEWStep 6: Output - Method 1 and Method 2
VIEWStep 7: Proof that I have done it myself - Method 1 and Method 2
VIEWSolution
VIEWStep by step
Solved in 8 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY