Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Rectangle extends Shape {
- //have to create objects
- Point a = new Point();
- Point b = new Point();
- Point c = new Point();
- Point d = new Point();
- Point Center = new Point();
- public Rectangle() {
- // TODO Auto-generated constructor stub
- }
- public Rectangle(double x, double y) {
- //super(x, y);
- // TODO Auto-generated constructor stub
- }
- public Rectangle(Point a1, Point b1, Point c1, Point d1){
- a.setX( a1.getX() );
- a.setY( a1.getY() );
- b.setX( b1.getX() );
- b.setY( b1.getY() );
- c.setX( c1.getX() );
- c.setY( c1.getY() );
- d.setX( d1.getX() );
- d.setY( d1.getY() );
- /*
- angThree.setX( three.getX() );
- angThree.setY( three.getY() );
- angFour.setX( four.getX() );
- angFour.setY( four.getY() );
- */
- Center.setX( ( ( a.getX() + b.getX() + c.getX() + d.getX() ) / 4 ) );
- Center.setY( ( ( a.getY() + b.getY() + c.getY() + d.getY() ) / 4 ) );
- }
- @Override
- double calculateArea() {
- // TODO Auto-generated method stub
- return 0;
- }
- @Override
- public String toString() {
- String output = "\nThe Co-ordinates of this Rectangle are: \n";
- output += "\tA = " + "( " + a.getX() + ", " + a.getY() + " )";
- output += "\tB = " + "( " + b.getX() + ", " + b.getY() + " )";
- output += "\tC = " + "( " + c.getX() + ", " + c.getY() + " )";
- output += "\tD = " + "( " + d.getX() + ", " + d.getY() + " )";
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement