Question: Code the following java class Parallelogram - skew Angle: double get + Parallelogram) + Parallelogram(Point, Point, double) + baseLength(): double Parallelogram adds the private attribute
Code the following java class


Parallelogram - skew Angle: double get + Parallelogram) + Parallelogram(Point, Point, double) + baseLength(): double Parallelogram adds the private attribute skewAngle, which is the angle between the positive x axis and the left edge of the parallelogram. The default constructor should delegate to the default Rectangle constructor, and manually set skewAngle to r/2. The second constructor takes two points, the upper right and lower left corners, and a skew angle. Again, you can delegate to the parent constructor before setting the angle. The angle must be strictly less than 7, and must also be greater than the angle of the diago- nal of the surrounding rectangle, (i.e. skewAngle > Math.atan2 (y2 - y1, x2 - x1)). For convenience, check that the angle is in bounds, and if not simply set it back to the default of 1/2. Add the method baseLength() to return the length of the base of the parallelogram. The base - shown in the diagram above - refers to the base of the right triangle formed by cutting off one of its sides. You can calculate its length with this formula: base = height base tan Note that when the skew angle is wider than 1/2 radians, the orientation of this triangle is flipped, which will result in this value being negative
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
