Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

What are the five sources of cost advantage? Discuss.

Answered: 1 week ago

Question

Sketch the graph of each equation in Problems 3-30. \(y=x^{2}-4\)

Answered: 1 week ago

Question

design a simple performance appraisal system

Answered: 1 week ago