Right Triangle Class
Write a RightTriangle class that has the following fields: legA: a double legB: a double
The class should have the following methods:
No-argument constructor. Sets fields to 0 Constructor. Accepts legs of the right triangle as arguments. Constructor throws Illegal Argument Exception when one or both legs are set to 0 or negative number(s)
setLegA(), setLegB() - mutator methods. Both methods throw Illegal Argument Exception when leg is set to 0 or negative number. getLegA(),getLegB()-accessor methods. getHypotenuse() - calculates and returns hypotenuse of the triangle. GetArea() - calculates and returns area of the right triangle getPerimeter()- calculates and returns perimeter of the triangle Call the source code files RightTriangle.java.
Write a class with main() that uses your class. Please do not collect input from the user. Instead, call ALL the methods of the class with the data you choose to make sure the methods work properly. In the comments explain why you decided to use these particular test cases. Have try/catch blocks that handle Illegal Argument Exception. Make sure you write the call that invokes Illegal Argument Exception in main(). In addition, make sure to call class constructors and mutator methods with bad arguments to showcase exception throwing/catching in action.
Call the source code files TriangleDemo.java.