You are on page 1of 2

Laboratory 5

Ap1.

Create a new class: Lab_05_1_surname_name

Create a program for automatic grading by reading from the keyboard the number of point
(number of points ranges from 10 to 100). Grading is given from the following flowchart:
Ap2.

Create a new class: Lab_05_2_surname_name

Read two real numbers (double) from the keyboard that represents Cartesian coordinates x0
and y0 of a point P calculate polar coordinates. Display results r and  ( in degrees).

Do not use the atan2 function.

r  x 2  y 2
y   x1  r cos( )
0 0

  y0    y  r sin( )
  arctan    1
y0 P(x0,y0)   x0 



x0 x

Indications:

For validation, check the Cartesian coordinates x1 and y1 calculated from r and  values are
the same with x0 and y0 (use the absolute or relative error)

era  approximative _ value  exact _ value  1010

approximative _ value  exact _ valoare


err   1010
exact _ value

Check the results for the following points


x0 0 1 1 0 -1 -1 -1 0 1
y0 0 0 1 1 1 0 -1 -1 -1

If the results are correct show only one message.

You might also like