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 =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f550c3a4a1e_02766f550c320316.jpg)
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
Get step-by-step solutions from verified subject matter experts
