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.

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

9. How does one identify the essential functions of a job?

Answered: 1 week ago

Question

c int a = 1, b = 3; if (! (a

Answered: 1 week ago