Skip to content

Commit

Permalink
change this.color to getColor() and null to default figure
Browse files Browse the repository at this point in the history
  • Loading branch information
FroGitHub committed Dec 28, 2024
1 parent a58aa62 commit c58bfac
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public double getArea() {
public void draw() {
System.out.println("Figure: circle, area: "
+ getArea() + " sq. units, radius: "
+ this.radius + " units, color: " + this.color);
+ this.radius + " units, color: " + getColor());
}
}
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/FigureSupplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Figure getRandomFigure() {
return new IsoscelesTrapezoid(getRandomColor(), random.nextInt(1, 10),
random.nextInt(1, 10), random.nextInt(1, 10));
default:
return null;
return getDefaultFigure();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/IsoscelesTrapezoid.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public void draw() {
+ this.base1 + ", base2: "
+ this.base2 + ", height: "
+ this.height + " units, color: "
+ this.color);
+ getColor());
}
}
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/Rectangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public double getArea() {
public void draw() {
System.out.println("Figure: rectangle, area: "
+ getArea() + " sq. units, length: "
+ this.length + ", width: " + this.width + " units, color: " + this.color);
+ this.length + ", width: " + this.width + " units, color: " + getColor());
}
}
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/RightTriangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public void draw() {
+ getArea() + " sq. units, firstLeg: "
+ this.firstLeg + ", secondLeg: "
+ this.secondLeg + " units, color: "
+ this.color);
+ getColor());
}
}
4 changes: 2 additions & 2 deletions src/main/java/core/basesyntax/Square.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Square extends Figure {
public Square() {
}

public Square(String color, int site) {
public Square(String color, double site) {
super(color);
this.site = site;
}
Expand All @@ -21,6 +21,6 @@ public double getArea() {
public void draw() {
System.out.println("Figure: square, area: "
+ getArea() + " sq. units, side: "
+ this.site + " units, color: " + this.color);
+ this.site + " units, color: " + getColor());
}
}

0 comments on commit c58bfac

Please sign in to comment.