Define an exception class called DimensionException to use in the driver program from programming project.Modify that driver program to throw and catch a DimensionException if the user enters something less than or equal to zero for a dimension.
Create the classes RightTriangle and Rectangle, each of which is derived from the abstract class ShapeBase in Listing.Then derive a class Square from the class Rectangle. Each of these three derived classes will have two additional methods to calculate area and circumference, as well as the inherited methods. Do not forget to override the method drawHere. Give your classes a reasonable complement of constructors and accessor methods. The Square class should include only one dimension, the side, and should automatically set the height and width to the length of the side. You can use dimensions in terms of the character width and line spacing even though they are undoubtedly unequal, so a square will not look square (just as a Rectangle object, as discussed in this chapter, won’t look square). Write a driver program that tests all your methods.
/**Abstract base class for drawing simple shapes on the screenusing characters.*/ public abstract class ShapeBase implements ShapeInterface { private int offset; public abstract void drawHere(); The rest of the class is identical to ShapeBasics in Listing, except for the names of the constructors. Only the method drawHere is abstract. Methods other than drawHere have bodies and do not have the keyword abstract in their headings. We repeat one such method here: public void drawAt(int lineNumber) { for (int count = 0; count
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.