[POO] Removed unnecessary parenthesis

This commit is contained in:
TiagoRG 2023-03-07 11:53:37 +00:00
parent dfbb175836
commit 9eac577b42
1 changed files with 4 additions and 4 deletions

View File

@ -45,9 +45,9 @@ class Triangle {
public Triangle(double side1, double side2, double side3) { public Triangle(double side1, double side2, double side3) {
assert side1 > 0 && side2 > 0 && side3 > 0; assert side1 > 0 && side2 > 0 && side3 > 0;
if((Math.abs(side2 - side3) < side1 || side1 < side2 + side3 if(Math.abs(side2 - side3) < side1 || side1 < side2 + side3
|| Math.abs(side1 - side3) < side2 || side2 < side1 + side3 || Math.abs(side1 - side3) < side2 || side2 < side1 + side3
|| Math.abs(side1 - side2) < side3 || side3 < side1 + side2)) || Math.abs(side1 - side2) < side3 || side3 < side1 + side2)
throw new IllegalArgumentException("Triangle cannot be created with those sides."); throw new IllegalArgumentException("Triangle cannot be created with those sides.");
this.side1 = side1; this.side1 = side1;
this.side2 = side2; this.side2 = side2;
@ -60,9 +60,9 @@ class Triangle {
public void setSides(double side1, double side2, double side3) { public void setSides(double side1, double side2, double side3) {
assert side1 > 0 && side2 > 0 && side3 > 0; assert side1 > 0 && side2 > 0 && side3 > 0;
if((Math.abs(side2 - side3) < side1 || side1 < side2 + side3 if(Math.abs(side2 - side3) < side1 || side1 < side2 + side3
|| Math.abs(side1 - side3) < side2 || side2 < side1 + side3 || Math.abs(side1 - side3) < side2 || side2 < side1 + side3
|| Math.abs(side1 - side2) < side3 || side3 < side1 + side2)) || Math.abs(side1 - side2) < side3 || side3 < side1 + side2)
throw new IllegalArgumentException("Triangle cannot be created with those sides."); throw new IllegalArgumentException("Triangle cannot be created with those sides.");
this.side1 = side1; this.side1 = side1;
this.side2 = side2; this.side2 = side2;