Question: public class Polygon { /* Attributes */ private Point[] vertices = new Point[size]; // list of vertices in order /* Constructors */ public Polygono /*

 public class Polygon { /* Attributes */ private Point[] vertices =

public class Polygon { /* Attributes */ private Point[] vertices = new Point[size]; // list of vertices in order /* Constructors */ public Polygono /* Getters and Setters */ public Point[getVertices() { return vertices; 3 public void setVertices(Point[] vertices) { this.vertices = vertices; } /* Other methods */ public double area { System.out.println("I won't compute it at this level. Please run it at the subclass level"); return -1; } public class Rectangle extends Polygon { /* Constructors */ public Rectangle() { super(); } public double area() { Point[] vertices = getVertices(); double side1 = Math.sqrt(Math.pow(vertices[0].getX(-vertices[1].getX(), 2) + Math.pow(vertices[0].getYO-vertices[1].getYO, 2)); double side2 = Math.sqrt(Math.pow(vertices[2].getX(-vertices[1].getX(), 2) + Math.pow(vertices[2].getY(-vertices[1].getYO, 2)); return side1 * side2; } What do you observe in this code among the following? Encapsulation Overloading Overriding For each property you observed, explain where in the code you observed it and what it means

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!