Question: Java Create a Triangle class with attribute sides a , b , c and methods calculateArea ( ) and calculatePerimeter ( ) Create a RightAngleTriangle

Java
Create a Triangle class with attribute sides a,b,c and methods calculateArea() and calculatePerimeter()
Create a RightAngleTriangle class inheriting Triangle with overridden methods calculateArea() and calculatePerimeter()
in the methods do the relevant calculations and return the result.
Write a App called TriangleApp that would instantiate Triangle object with sides and RightAngleTriangle with side.
Write a separate method called calculateAndPrint() with a formal parameter of type Triangle. call calculateArea and calculatePerimeter methods inside and print the results.
In the main method of the App call the calculateAndPrint() method for both Triangle object and RightAngleTriangle object
Area of RightAngleTriangle : 1/2* base * height
Area of Triangle(In general): s(s - a)(s - b)(s - c)
s =(a + b + c)/2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!