The class Shapes includes two void methods: calcTriangleArea( ) and calcTrianglePerimeter( ). The calcTriangleArea ( ) method takes two int parameters (base and height), calculates the area of a triangle, and assigns the value to a private instance variable (area). The calcTrianglePerimeter( ) method takes three int parameters (lengthSide1, lengthSide2, and lengthSide3), calculates the perimeter of a triangle, and assigns the value to a private instance variable (perimeter). The Shapes class also includes two getter methods, which return the calculated values. The Shapes class implements the Calculatable interface. Write the Shapes class and the Calculatable interface.
The class Shapes includes two void methods: calcTriangleArea( ) and calcTrianglePerimeter( ). The calcTriangleArea ( ) method takes two int parameters (base and height), calculates the area of a triangle, and assigns the value to a private instance variable (area). The calcTrianglePerimeter( ) method takes three int parameters (lengthSide1, lengthSide2, and lengthSide3), calculates the perimeter of a triangle, and assigns the value to a private instance variable (perimeter). The Shapes class also includes two getter methods, which return the calculated values. The Shapes class implements the Calculatable interface.
Write the Shapes class and the Calculatable interface.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images