Define an exception class called DimensionException to use in the driver program from Programming Project 4 in

Question:

Define an exception class called DimensionException to use in the driver program from Programming Project 4 in Chapter 8. Modify that driver program to throw and catch a DimensionException if the user enters something less than or equal to zero for a dimension.


Programming Project 4 in Chapter 8.

Create the classes RightTriangle and Rectangle, each of which is derived from the abstract class ShapeBase in Listing 8.19. 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: