Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Create an abstract class called Shape, which stores are array of Point2D objects and has queries for the points which represent the vertices, each

1) Create an abstract class called Shape, which stores are array of Point2D objects and has queries for the points which represent the vertices, each accessed by an index.

public class Point2D {

private double[] coords;

/** default constructor - this constructor calls the other one giving default x and y coordinates of 0.0 , 0.0

@custom.ensure getX() == 0.0 @custom.ensure getY() == 0.0

*/ public Point2D() { this(0.0,0.0); }

/** overloaded constructor taking two doubles as arguments for the x and y coordinates

@param x The initial horizontal coordinate of this point2D @param y The initial vertical coordinate of this point2D

@custom.ensure getX() == x @custom.ensure getY() == y */

public Point2D(double x, double y) { coords = new double[2]; coords[0] = x; coords[1] = y; }

/** @return The horizontal coordinate of this point2D */ public double getX() { return coords[0]; }

/** @return The vertical coordinate of this point2D */ public double getY() { return coords[1]; }

} // end class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago