Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

BPR always involves automation. Group of answer choices True False

Answered: 1 week ago