Question: Create a class named Triangle.java implementing TriangleInterface. Include the following data members and methods: three double data members representing the three sides of a triangle

Create a class named Triangle.java implementing TriangleInterface. Include the following data members and methods:

three double data members representing the three sides of a triangle (private)

Constructor which takes three double numbers representing the three sides of the triangle

getter methods

public void setSides(double a, double b, double c) to set three sides of a triangle

Implements the methods specified in the interface

If the three numbers can not form a valid triangle, assign 0 to all sides.

Once completed, create a plain text file named result.txt, then summarize (copy) the result from running the Grader.class

public interface TriangleInterface extends Comparable{ public double area(); //keep two decimal places public int compareTo(TriangleInterface tri); //the compareTo method returns the difference of the area between caller and argument triangles. Cast the area difference to int }

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!