Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago