Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Make an abstract class called Shape. The private attribute is shapeName of String type. It must include constructors (default and parameter), the services (getters

1. Make an abstract class called Shape. The private attribute is shapeName of String type. It must include constructors (default and parameter), the services (getters and setters). It will also have an abstract method of type int called calcArea().

2.Make a concrete class called Parallelogram. This class will be a class derived from the abstract class called Shape. Private attributes are base and height of type double. It must include constructors (default and parameter), the services (getters and setters) for the attributes. You must override the method Call calcArea() to calculate the area of the parallelogram (A = bh). The setBase method and setHeight method must handle data that is greater than than zero, otherwise you must throw to the exception ArithmeticException.

3. Make a class called ShapeDriver. The main method must instantiate the class Parallelogram, Rectangle, and Circle (assume that the Rectangle and Circle classes they're made). Create an array [3] of type Shape and assign each instance of the objects: parallelogram, rectangle and circle created before. Make a loop so that ask the information of each geometric figure. If you enter any negative data main must catch the ArithmeticException exception. make another loop where it will present the information of each geometric figure: the name of the figure, the sides, and the area of the figure.

IN JAVA

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

What is dividend payout ratio ?

Answered: 1 week ago

Question

Explain the factors affecting dividend policy in detail.

Answered: 1 week ago

Question

What aspects would it be impossible to capture?

Answered: 1 week ago

Question

Enhance your words with effective presentation aids

Answered: 1 week ago