Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LABORATORY ASSIGNMENT 8 Dr. Duncan, CSC 1350, Louisiana State University 11/09/2017 Implementing an Ellipse Class Implement a basic Ellipse2D class whose objects represent an ellipse
LABORATORY ASSIGNMENT 8 Dr. Duncan, CSC 1350, Louisiana State University 11/09/2017 Implementing an Ellipse Class Implement a basic Ellipse2D class whose objects represent an ellipse in a plane Definition: An ellipse is a shape containing two interior points, the foci, such that the sum of the distances from any point on its perimeter to the foci is constant. See Figure 1 The area and perimeter of an ellipse can be calculated using the formulas below. perimeter 3(width + height)-M3 uidth + height) (width + 3 height) width (x.y) height Figure 1: A Visual Depiction of an Ellipse The Ellipse2D Class The Elipse2D class should have x, y, width and height, all doubles, as private instance variables of an Ellipse2D object. The X and Y-coordinates represent the top left corner of the bounding box of the ellipse, also referred to as its location. The widtth is its horizontal diameter and the height is its vertical diameter, both of which intersect at the center of the ellipse. The screern and cartesian coordinate systems are different: the Y-coordinates increase downward and decrease upward on the screen. This exercise assumes screen coordinates. Assignment N2 8 Page 1 The class should include the following constructors: public EMipse2DO: creates an ellipse located at (0,0) whose width and height are both 0. public Ellipse2D (double xLoc, double yLoc, double w, double h): creates an ellipse from the specified coordinates, where rLoc and yLoc are its location and w and h are its width and height respectively The class should have the following instance (accessor and mutator) methods: public double getHeight): returns the height of the framing rectangle in double precision. public double getWidth(): returns the width of the framing rectangle in double precision public double getX): returns the X-coordinate of the upper-left corner of the framing rect- angle in double precision. .public double getYO: retums the Y-coordinate of the upper-left corner of the framing rect- angle in double precision
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