Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!