Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started