Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started