
Specifying Private Access Specifiers and Use of Public Methods 5.11
42. }
43. }// end of Polar1Demo
Output: Enter Cartesian form Vector Details <real number a>: 3
Enter Imaginary <b> : 4
Enter magnitude <r> :
Inside the classes member function .
magnitude <r> :12.5Angle<t>53.13010235415598
Line Nos. 5 to 8: declare the attributes as private and type double.
Line Nos. 10 to 20: defines a method for GetData() that obtains data from
keyboard using Biffered Reader at Line No. 12. It also uses
try and catch blocks at Line Nos. 11 and 19.
Line Nos. 23, 24 and 26: use Math class methods like sqrt, atan and toDegrees
Notice that when we refer to priv ...