Lab 27

Hip to be Square

 

Objective:

 

Write two classes:  One class draws a square, and an exception that occurs when the user puts in an invalid dimension.

 

 

Example Dialog:

Welcome to the easy square program

Enter the length of the side of a square or enter QUIT to quit

5

*****

*****

*****

*****

*****

The area is 25

The perimeter is 20

Enter the length of the side of a square or enter QUIT to quit

0

Dimensions must be of length one at least

Enter the length of the side of a square or enter QUIT to quit

Lab Report Questions:

  1. Describe what an exception does.
  2. Describe the order in which a series of “catches” need to be.

Finally:

Upload DimensionException and Sqaure file to the dropbox