Feedback for these lessons is very much welcome. If you like or hate something about a lesson let us know, either on GitHub, via Mail or just tell us in person ;)
x
A07 - Exception for Shapes
This time we want to handle the exception of the user inputs.1
Step 1
Throw a exception if the un overriden “calculateArea” method in Shape
is used.
Hint: Which exception would be the suited one?
Step 2
Update the CreatePolygon
method so that the program catches a wrong input (no int
).
The user need to enter a new point if there was a problem.
Step 3
Update both, the CreatePolygon
and the CreateCircle
method, with exception handling for the radius or vertex count.
Hint: Maybe you need to update the whole process of entering the numbers.
Step 4
Comment your new code.