Remember this is a right triangle so you can use the


Based on the previous exercise, please create the Triangle class:

  • the attributes or properties are: o base o height
  • the following methods: o setBase o setHeight o getBase o getHeight o getHypotenuse o getArea o getPerimeter
  • and 2 constructors

Remember this is a right triangle, so you can use the Pythagorean Theorem to calculate the hypotenuse. The hypotenuse will be used for the Perimeter calculation. When doing that calculation, please do not repeat the hypotenuse formula, use the method already defined in the class. Do not add any other properties nor methods to the class. Follow instructions. You should ask the user to enter a value for the height and base of two different triangles and then output the hypotenuse, area, and perimeter of each triangle. Each triangle object must be instantiated using a different constructor. For example, triangle using the constructor without parameters and triangle1 using the constructor with parameters.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Remember this is a right triangle so you can use the
Reference No:- TGS02724407

Now Priced at $10 (50% Discount)

Recommended (95%)

Rated (4.7/5)