Question: Write class called Triangle that can be used to represent a triangle. It should include the following methods: a) is_scalene (no two sides are the

Write class called Triangle that can be used to represent a triangle. It should include the following methods:

a) is_scalene (no two sides are the same length)

b) is_isosceles (exactly two sides are the same length)

c) is_equilateral (all three sides are the same length)

d) calculatePerimeter (calculate the perimeter of the triangle)

Write separate .java file with the main method to test the Triangle class.

Here is the Triangle class structure (Triangle.java):

Class Triangle {

int side1;

int side2;

int side3;

boolean isScalene() {

}

boolean isIsosceles() {

}

boolean isEquilateral() {

}

int calculatePerimeter(){

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Sure Heres the implementation of the Triangle class in Java java class Triangle int side1 int side2 ... View full answer

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 Programming Questions!