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