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 abc 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 : base height
Area of TriangleIn general: ss as bs c
s a b c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
