Question: y)- TASK1: Study the lecture notes (Powerpoint slides and pre-recorded lectures) and assigned readings before you start. TASK 2: Replace '9? with your name, creation



y)- TASK1: Study the lecture notes (Powerpoint slides and pre-recorded lectures) and assigned readings before you start. TASK 2: Replace "'9?" with your name, creation date, and a description of the program (synopsis). TASK 3: Follow the instructions given in the comments found in the main function and the instructions below. Add functions and function prototypes as specified below. When completed, the program reads in the polar coordinates of a point and computes and outputs the Cartesian coordinates. The main() function of the program is already provided in the template. DO NOT MODIFY ANY OF THE CODE in procedure main(). Your task is to add two functions, degreesZradiansO and compute_coord(), so that the program produces the desired results. 'I. DO NOT MODIFY ANY OF THE CODE in procedure main(). 2. All functions should be written AFTER the main procedure. 3. A function prototype should be written for each function and placed BEFORE the main procedure. 4. Each function should have a comment explaining what it does. 5. Each function parameter should have a comment explaining the parameter. 6. Note that polarcoordcpp will NOT compile since the function prototypes and function definitions are missing. 7. Program polarcoordcpp: a. Write a function degrees2radians0 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=Dxn/180 where D is degrees and R is radians. b. Write a function compute_coordO 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 xcoordinate of the point, iv. the ycoordinate of the point. All parameters should have type double. The rst 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 modies the last two parameters. The formula to compute the x and ycoordinates from the polar coordinates is: x = radius x cos(angle), y = radius x sin(angle), where radius is the polar radius, angle is the angle measured in radians, x is the xcoordinate and y is the ycoordinate of the point. The formula to compute the x and y-coordinates from the polar coordinates is: x = radius x cos(angle), y = radius x sin(angle), where radius is the polar radius, angle is the angle measured in radians, x is the x-coordinate and y is the y-coordinate of the point. 409358.2719586.qx3zqy7 LAB 5/9 ACTIVITY 6.21.1: Functions (Part 1) polarcoord.cpp Load default template... 49 50 double degrees2radians( double angle_degrees) { 51 double radian; 52 double piVal=3. 14159265; 53 54 radian=(angle_degrees*piVal)/180; 55 56 return radian; 57 3 58 59 // DEFINE FUNCTION compute_coord here: 60 void compute_coord(double polarRadius, double polarAngle, double& x_coordinate, double& y_coordinate){ 61 double angleInRadian=degrees2radians(polarAngle) ; 62 x_coordinate=polarRadius*cos_(angleInRadian); 63 y_coordinate=polarRadius*sin(angleInRadian>; 64 3 When done developing your program, press the Submit for grading button below. This will Develop mode Submit mode submit your program for auto-grading. Submit for grading Coding trail of your work What is this? 10/8 50, 0, 0, 0,0, 0- WO, 0, 0,0 null0, 0, 0, 5, 0,0, 0, 1 min : 371: Compare output A Input 1 0 Your output 2: Compare output A Output differs. See highlights below. Input 1 30 Your output iius: Expected output 3: Compare output A Output differs. See highlights below, Input 1 240 Your output Expected output 4: Compare output A Output differs. See highlights below: Enter radius: Enter polar angle Enter polar angle Enter radius: Enter radius: l/l Enter polar angle (degrees): Cartesian coordinates: (1,0) O/l (degrees): Cartesian coordinates: (O.999958,0.0091384) (degrees): Cartesian coordinates: (0.866025,0.5) O/l Enter polar angle (degrees): Cartesian coordinates: (0.997 Enter polar angle (degrees): Cartesian coordinates: (-O.5, O/l
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
