Question: Problem 7: Rectangle Implement a class Rectangle. A Rectangle is defined by its x- and y-coordinates of its upper-left and lower-right corners. Your job is

Problem 7: Rectangle Implement a class Rectangle. A Rectangle is defined by its x- and y-coordinates of its upper-left and lower-right corners. Your job is to determine whether the rectangle is a square, or is in "portrait" or "landscape" orientation, and return the result in the getorientation method. Assume all coordinates will be valid double values. Implement the Rectangle class using the template provided here: Rectangle.java .. Examples: Rectangle r1 = new Rectangle (10.5, 22.5, 20.5, 12.5); r1.getOrientation(); // returns "square" Rectangle r2 = new Rectangle (10.5, 32.5, 21.5, 12.5); r2.getOrientation(); // returns "portrait" Rectangle r3 = new Rectangle(-10.5, 22.5, 21.5, 12.5); r3.getorientation(); // returns "landscape
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
