Question: Write a program that shuffles an ArrayList of triangles. You must use the same Triangle class that you designed. Triangle class: Shape class that extends:

Write a program that shuffles an ArrayList of triangles. You must use the same Triangle class that you designed.

Triangle class:

Write a program that shuffles an ArrayList of triangles. You must use

Shape class that extends:

the same Triangle class that you designed. Triangle class: Shape class that

public class Triangle extends Shape { static int numofobjects; double siden, side2, side3; public Triangle( double sidel, double side2, double side3){ this.sidel = sidel; this.side2 = side2; this.side3 = side3; this.numo fobjects++; public static int getNumberOfObjects() { return Triangle.numo fObjects; public boolean isEquilateralTriangle() { return (this.sidel == this.side2) && (this.side2 == this.side3); public boolean isRightAngled Triangle() { double a = this.sidel; double b = this.side2; double c = this.side3; return (a*a == b*b + c*c) || (b*b == a*a + C*C) || (a*a == b*b + C*C); public double getArea(){ double a = this.sidel; double b = this.side2; double c = this.side3; double s = (a+b+c)/2; return Math.sqrt(S*(s-a)*(s-b)*(S-c)); public double getPerimeter() { double a = this.sidel; double b = this.side2; double c = this.side3; return a+b+c; public String toString(){ String str = "Triangle: "+ "sidel = "+this.side1+ ", " + "side2 = "+this.side2+ " " + "side3 = "+this.side3; return str; import java.lang. String; import java.util.Date; import java.lang.Object; public abstract class Shape extends Object { private final Date dateCreated = new Date(); protected Shape () { super(); public Date getDateCreated() { return this.dateCreated; @Override public String toString() { return "created on " + this.getDateCreated(); public abstract double getArea(); public abstract double getPerimeter(); public class Triangle extends Shape { static int numofobjects; double siden, side2, side3; public Triangle( double sidel, double side2, double side3){ this.sidel = sidel; this.side2 = side2; this.side3 = side3; this.numo fobjects++; public static int getNumberOfObjects() { return Triangle.numo fObjects; public boolean isEquilateralTriangle() { return (this.sidel == this.side2) && (this.side2 == this.side3); public boolean isRightAngled Triangle() { double a = this.sidel; double b = this.side2; double c = this.side3; return (a*a == b*b + c*c) || (b*b == a*a + C*C) || (a*a == b*b + C*C); public double getArea(){ double a = this.sidel; double b = this.side2; double c = this.side3; double s = (a+b+c)/2; return Math.sqrt(S*(s-a)*(s-b)*(S-c)); public double getPerimeter() { double a = this.sidel; double b = this.side2; double c = this.side3; return a+b+c; public String toString(){ String str = "Triangle: "+ "sidel = "+this.side1+ ", " + "side2 = "+this.side2+ " " + "side3 = "+this.side3; return str; import java.lang. String; import java.util.Date; import java.lang.Object; public abstract class Shape extends Object { private final Date dateCreated = new Date(); protected Shape () { super(); public Date getDateCreated() { return this.dateCreated; @Override public String toString() { return "created on " + this.getDateCreated(); public abstract double getArea(); public abstract double getPerimeter()

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!