Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java programs: 1. Create the class Ellipse with all the required instance variables, the constructor, all the get and set methods, the isValid and toString
Java programs:
1. Create the class Ellipse with all the required instance variables, the constructor, all the get and set methods, the isValid and toString methods, as described in the Project 3 assignment.
2. Create the class EllipseTester and test all the Ellipse methods you implemented in step 1.
Project Details: For this project you will have to write two classes. Class Ellipse is a class that represents an axis-aligned ellipse. Class EllipseTester is the driver class, used to test the Ellipse class Class ellipse: An instance of the class Ellipse represents a valid axis-aligned ellipse. It has several instance variables that one needs to use to describe an ellipse, as well as methods that operate on these variables. Ellipse instance variables.: Class Ellipse will have the following instance variables: x-a double that represents the x coordinate of the ellipse y-a double that represents the y coordinate of the ellipse * width - a double that represents the width of the ellipse . height - a double that represents the height of the ellipse rectMode - a boolean: if true (x,y) is the upper left corner of the ellipse bounding box; if false (x,y) is the ellipse's center point color - a String that represents the color of the ellipse . . For an ellipse to be valid, the width and height must be between 0 and 1 inclusive, the ellipse area must be contained within a bounding box defined by the points (-100, -100) and (100, 100), and the color must be one of the following: "black", "red", "green", "blue" Ellipse constructor: The Ellipse constructor should be: Ellipse (double x, double y, double height, double width, String color, boolean rectMode) The constructor should check that these values represent a valid ellipse. If they do, then it should initialize the ellipse to these values. Otherwise, the ellipse should be initialized to an ellipse at (0, 0), width 1, height 1, rectMode false, color "red
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