Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I need help with this programming problem. Add functions and function protot

ID: 3757970 • Letter: H

Question

Hi, I need help with this programming problem.
Add functions and function prototypes to the file polarcoord.cpp as specified below. When completed, the program reads in the polar coordinates of a point and computes and outputs the Cartesian coordinates. The main() routine of the program is already provided in polarcoord_template.cpp (which you copied into polarcoord.cpp.) DO NOT MODIFY ANY OF THE CODE in procedure main(). Your task is to add two functions, degrees2radians() and compute_coord(), so that the program produces the desired results.

Do not modify codes in the main function of the template.
Program polarcoord.cpp: a. Write a function degrees2radians() which converts degrees to radians. The function has one parameter: an angle in degrees of type double. The function returns a value of type double which is the angle in radians. The formula to convert degrees to radians is: R = D × ? /180 where D is degrees and R is radians. b. Write a function compute_coord() which computes the Cartesian (x, y) coordinates of a point from its polar coordinates (radius, angle) where angle is measured in radians. The function has four parameters listed in the following order: i. the polar radius of the point, ii. the polar angle in radians of the point, iii. the x-coordinate of the point, iv. the y-coordinate of the point. All parameters should have type double. The first two parameters should be passed by value and the last two parameters should be passed by reference. The function does not return any value, but it modifies the last two parameters. The formula to compute the x and y-coordinates from the polar coordinates is: x = radius × cos(angle), y = radius × sin(angle), where radius is the polar radius, angle is the angle measured in radians, x is the xcoordinate and y is the y-coordinate of the point.
Template:

#include <iostream>
#include <cmath>

using namespace std;

// FUNCTION PROTOTYPE FOR degrees2radians


// FUNCTION PROTOTYPE FOR compute_coord


// DO NOT MODIFY THE MAIN ROUTINE IN ANY WAY
int main()
{
double angle_degrees(0.0), angle_radians(0.0), radius(0.0);
double coord_x(0.0), coord_y(0.0);

// Read in polar coordinates
cout << "Enter radius: ";
cin >> radius;

cout << "Enter polar angle (degrees): ";
cin >> angle_degrees;

// Convert degrees to radians
angle_radians = degrees2radians(angle_degrees);

// Compute Cartesian (x,y) coordinates
compute_coord(radius, angle_radians, coord_x, coord_y);

// Output Cartesian coordinates
cout << "Cartesian coordinates: ";
cout << "(" << coord_x << "," << coord_y << ")" << endl;

return 0;
}

// DEFINE FUNCTION degrees2radians here:


// DEFINE FUNCTION compute_coord here:

Finally, the output should exactly match the sample solution below:

Thanks for any help.

Explanation / Answer

#include #include using namespace std; double Radius(double x, double y); double Theta (double x, double y); int main() { double x, y; y = 0.0; x = 0.0; cin >> x, y; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote