Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java program that estimates the perimeters and areas of Parallelogram, Triangle and square. The polygon interface contains abstract methods as follows: area (),

Create a Java program that estimates the perimeters and areas of Parallelogram, Triangle and square.

The polygon interface contains abstract methods as follows: area (), perimeter () and polygon_Name ().

The Parallelogram class implements the polygon interface and includes two private double parameters: height and base with public get and set methods for theses parameters.

The Rectangle class extends the Parallelogram class. You should override methods from the superclass.

The Square class extends the Parallelogram class with an additional private double parameter named side. You should add public get and set methods and override methods from the superclass.

In the main class. The program should ask the user about how many objects will be created with their corresponding types (Parallelogram, Rectangle or Square) and parameters. All objects will be saved in an array list. The program should print out the name, perimeter, and the area of each one

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