Question: please help me with this java programming past paper 3. Object Oriented Programming (a) With reference to Object Oriented programming, what is meant by the
3. Object Oriented Programming (a) With reference to Object Oriented programming, what is meant by the terms Encap- 13] (b) The Polar Coordinate System is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a fixed point and an angle from a sulation and Data Hiding? fixed direction. i. Design a class, PolarPoint that stores a fixed origin Point (that is shared by all instances of the PolarPoint class and is initialed using Point origin = new Point (0,0) ;) and a distance and angle from the reference point. You can assume that the angle is always relative to an infinite line extending to [51 the right of the point (see diagram). (3, bu) (0, 0) (4, 210) ii. Converting between polar and cartesian coordinate systems can be done using the sine and cosine operations. Write a method that returns a Point in the cartesian coordinate system. You may find the Math.cos (double a) and Math.sin (double a) meth- ods useful iii. Cartesian coordinates can be converted back to polar coordinates using ry(xorign)(y -origin)2 atan2((y-yorigin), (1-Zorigin)) Write a constructor method that creates a PolarPoint object from a Point object. For this question you may need to use the Math.sqrt (double a) and Math.atan2 (double y, double x) methods. iv. Write a function that calculates the shortest straight-line distance between two PolarPoint objects (Hint: This may be easier using the cartesian coordinate system)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
