Question: Java Help I have the code partially done but it is not working correctly. I included my Ellipse class since I am having trouble with

Java Help I have the code partially done but it is not working correctly. I included my Ellipse class since I am having trouble with the EllipseTester class

Java Help I have the code partially done but it is not

working correctly. I included my Ellipse class since I am having trouble

with the EllipseTester class public class Ellipse { private double x,y,width,height; private

public class Ellipse { private double x,y,width,height; private boolean rectMode; private String color; //declare instance variables public Ellipse(double x, double y, double width, double height) { x = 0.0; y = 0.0; width = 0.0; height = 0.0; rectMode = false; color = "None"; } /*Constructor checks if parameters are valid through the isValid method and sets * ellipse to default settings if not. */ Ellipse(double x, double y, double height, double width, String color, boolean rectMode) { if(isValid(x,y,width,height,rectMode,color)) { this.x=x; this.y=y; this.height = height; this.width = width; this.color = color; this.rectMode = rectMode; } else { this.x = 0; this.y = 0; this.width = 1; this.height = 1; this.rectMode= false; this.color= "red"; } } //returns x public double getX() { return x; } //returns y public double getY() { return y; } //returns width public double getWidth() { return width; } //returns height public double getHeight() { return height; } //returns (x,y) public boolean getRectMode() { return rectMode; } //Returns color public String getColor() { return color; } //Checks if X is within the bounding box public void setX(double x) { if(x>=-100 && x=-100 && y=0 && height=0 && height

return perimeter; } //Computes & returns area of ellipse public double computeArea() { double area = 0.0; area=Math.PI*x*y; return area; } // Returns a booleans if the ellipse contains a point public boolean containsPoint(double x, double y) { if(this.x == x && this.y==y) return true; else return false; } //returns a true value if the ellipse satisfies all the bounds public static boolean isValid(double x, double y, double w, double h, boolean m, String c) { //returns rectMode m as true if at x,y if(x==0 && y==0){ m=false; } else{ m=true; } //returns other variables as true if they satisfy bounds. if((h>=0 &&h=0 && w =-100 && x=-100 && y 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!