Question: Need this info... thank you! 1. How does object-oriented programming promote code reuse? For this, i normally use Eclipse to create a java project. 2.

Need this info... thank you!

1. How does object-oriented programming promote code reuse?

For this, i normally use Eclipse to create a java project.

2. Using the programming language of your choice, create a class for Triangle objects. This Triangle class should inherit from a Shape class and implement its own getArea() and getPerimeter() methods.Include a constructor that expects three double values for a triangles sides. Create a program to test your Triangle class, and include a method that takes a Shape object as a parameter. Pass a Triangle object to this method to display the data.

Hint: To find a triangles area, use the following formula (given three sides):

public double getArea(){

double s = (side1 + side2 + side3)/2;

return Math.sqrt(s * (s-side1) * (s-side2) * (s-side3));

}

Thank you so much!!!

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!