Help,
I'm trying to get which object has the greater area of the 3 triangles. Also want to print out the info for each triangle object by calling toString(). If any one would check my work I have done if for any change I need it.
Thank you.
// testerTriangle
public class TestTriangle {
public static void main (String [ ] args) {
Triangle Triangle01 = new Triangle( 2, 4.5, 6 );
Triangle Triangle02 = new Triangle( 1, 3.5, 3 );
Triangle Triangle03 = new Triangle( 3, 2.5, 4 );
System.out.println("The Triangle01 Sides are " + Triangle01.toString());
System.out.println("The Triangle’s Area is " + Triangle01.getArea());
System.out.println("The Triangle’s Perimeter is " + Triangle01.getPerimeter());
System.out.println("\nThe Triangle02 Sides are " + Triangle02.toString());
System.out.println("The Triangle’s Area is " + Triangle02.getArea());
System.out.println("The Triangle’s Perimeter is " + Triangle02.getPerimeter());
System.out.println("\nThe Triangle03 Sides are " + Triangle03.toString());
System.out.println("The Triangle’s Area is " + Triangle03.getArea());
System.out.println("The Triangle’s Perimeter is " + Triangle03.getPerimeter());
if ( Triangle01.getArea() > Triangle02.getArea() && Triangle01.getArea() > Triangle03.getArea() )
System.out.println( "\n TRIANGLE 01 is greater. ");
else if ( Triangle02.getArea() > Triangle01.getArea() && Triangle02.getArea() > Triangle03.getArea() )
System.out.println( "\n TRIANGLE 02 is greater. ");
else if ( Triangle03.getArea() > Triangle01.getArea() && Triangle03.getArea() > Triangle02.getArea() )
System.out.println( "\n TRIANGLE 03 is greater. ");
else
System.out.println( "\n TRIANGLE IS NOT EQUAL. ");
}
}