Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/core/basesyntax/AreaCalculable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove the empty line between the package declaration and the interface declaration so the interface starts immediately after the package statement.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item: "Don't begin class or method implementation with an empty line." Remove the redundant empty line before the public interface AreaCalculable declaration (line 2).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item: "Don't begin class or method implementation with an empty line." Remove the blank line before the public interface AreaCalculable declaration so the interface starts immediately after the package line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file starts the interface implementation with an empty line. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line at line 2 so the interface declaration immediately follows the package statement.

public interface AreaCalculable {
double getArea();
}
24 changes: 24 additions & 0 deletions src/main/java/core/basesyntax/Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a redundant empty line after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line." Remove this blank line to comply with the style rules.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty line between the package declaration and the class declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the class starts immediately after the package declaration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains a blank line immediately after the package statement. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to comply with the guideline.

public class Calculator {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line right after the class declaration before the first field. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this empty line so the first field appears directly after the class opening.

private static final int FIGURE_ARRAY_SIZE = 6;

public static void main(String[] args) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty line immediately after the main method signature. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the method body starts without a leading empty line.

FigureSupplier figureSupplier = new FigureSupplier();
Figure[] figures = new Figure[FIGURE_ARRAY_SIZE];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line inside the method before the first loop. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to make the method body more compact.

for (int i = 0; i < figures.length / 2; i++) {
figures[i] = figureSupplier.getRandomFigure();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential NullPointerException risk when assigning random figures.

You call figureSupplier.getRandomFigure() and assign it directly: figures[i] = figureSupplier.getRandomFigure();. The checklist requires: "Don't return null from a method." Currently the FigureSupplier implementation contains a default branch that returns null, so figures[i] might be null and cause problems later when draw() is invoked. Either ensure FigureSupplier.getRandomFigure() never returns null (fix its switch/default) or add a null-check/handling here. See FigureSupplier implementation for the null-returning branch.

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line inside the method between the two loops. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep the method body tidy.

for (int i = figures.length / 2; i < figures.length; i++) {
figures[i] = figureSupplier.getDefaultFigure();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line inside the method before the final loop. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to comply with the style checklist.

for (Figure figure : figures) {
figure.draw();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling draw() without guarding against null figures.

You iterate for (Figure figure : figures) { figure.draw(); } — if any element is null (see earlier comment about getRandomFigure possibly returning null), this will throw a NullPointerException at runtime. Either guarantee suppliers never return null (preferred per checklist) or check if (figure != null) before calling draw(). Checklist: "Don't return null from a method."

}
}
}
23 changes: 23 additions & 0 deletions src/main/java/core/basesyntax/Circle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with an empty line right after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove redundant blank lines (e.g., line 2) so the class does not start with an empty line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty line immediately after the package declaration (and/or before the class body). The checklist says: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the redundant blank line(s) to conform to the style requirement.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — remove the blank line after the package declaration so the class starts without an empty line.

public class Circle extends Figure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — remove the blank line between the class declaration and the radius field so the field follows the class header directly.

private final double radius;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — remove the blank line between the field and the constructor so the constructor starts immediately after fields.

public Circle(String randomColor, double randomRadius) {
super(randomColor);
this.radius = randomRadius;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — remove the blank line before the getArea() method (annotation is fine, but avoid an extra blank line immediately above the method).

@Override
public double getArea() {
return Math.PI * Math.pow(radius, 2);
}

Comment on lines +2 to +16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant empty lines at and after the top of the file and before class/method bodies (lines 2, 4, 6, 11, 16). This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove these empty lines so the class and its members start without leading blank lines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — remove the blank line before the draw() method so the method follows the previous method without an extra leading empty line.

@Override
public void draw() {
System.out.println("Figure: circle, area: " + getArea()
+ " sq. units, radius: " + radius
+ " units, color: " + getColor());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draw() method prints the color by concatenating getColor() (an enum). The checklist requires: "Use name() for getting String representation of enum constants". To comply, print the enum's name() (for example getColor().name()), or getColor().name().toLowerCase() if you need lowercase output like "white". Example change: ... + " units, color: " + getColor().name() .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draw() concatenates getColor() (an enum). The checklist requires explicit enum-to-string handling: "Use name() for getting String representation of enum constants" — please change this to use getColor().name() (and optionally .toLowerCase() to match example output) so printed color is explicit and stable. See checklist.

}
}
11 changes: 11 additions & 0 deletions src/main/java/core/basesyntax/Color.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a redundant empty line after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line." Remove this blank line to comply with the style rules.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the redundant empty line after the package declaration. The checklist says: "Don't begin class or method implementation with an empty line." Move the enum declaration up so it directly follows the package line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line immediately after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the enum declaration follows the package line directly.

public enum Color {
YELLOW,
BLUE,
WHITE,
GREEN,
PURPLE,
BLACK,
RED
}
13 changes: 13 additions & 0 deletions src/main/java/core/basesyntax/ColorSupplier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a redundant empty line after the package declaration. This violates: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line at line 2 so the import appears immediately after the package declaration. See checklist guidance .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the package statement; remove it.

import java.util.Random;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line after the import statement; remove it.

public class ColorSupplier {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the class declaration (before the first field); remove it.

private final Random random = new Random();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist requires: "All magic numbers in your code should be constants." While Color.values().length works, introduce a constant like private static final int COLOR_COUNT = Color.values().length; and use random.nextInt(COLOR_COUNT) for clarity and to satisfy the constant requirement. (Also makes testing and maintenance easier.)


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between the field and the method signature; remove it.

public String getRandomColor() {
return Color.values()[random.nextInt(Color.values().length)].name();
}

Comment on lines +2 to +12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant empty lines at and after the top of the file and before class members (lines 2, 4, 8, 12). This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove these empty lines so the class and its members start without leading blank lines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line before the closing brace of the class; remove it.

}
5 changes: 5 additions & 0 deletions src/main/java/core/basesyntax/Drawable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a redundant empty line after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line." Remove this blank line to comply with the style rules.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a redundant empty line at line 2 (immediately after the package declaration). This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove that blank line so the public interface Drawable begins directly after the package statement.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line immediately after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the public interface Drawable line appears directly after the package statement.

public interface Drawable {
void draw();
}
17 changes: 17 additions & 0 deletions src/main/java/core/basesyntax/Figure.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the class declaration follows the package declaration directly.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty line immediately before the class declaration. This violates the checklist instruction: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)". Remove the blank line at line 2 before the class definition.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the package statement; remove it.

public abstract class Figure implements Drawable, AreaCalculable {
private final String color;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between the field declaration and the constructor. Remove this blank line to comply with the checklist requirement to avoid starting class/method blocks with empty lines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between the field declaration and the constructor; remove it so the constructor starts without a leading empty line.

public Figure(String color) {
this.color = color;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between constructor and getColor() method. Remove this blank line to follow the style guideline in the checklist.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between the constructor and the getColor() method; remove it so the method starts immediately after the constructor.

public String getColor() {
return color;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between getColor() method and the abstract getArea declaration. Remove this blank line to comply with the checklist style rules.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between getColor() and the abstract getArea() declaration; remove it.

public abstract double getArea();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between getArea() and draw() abstract declarations. Remove this blank line to follow the checklist guidance on redundant empty lines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between getArea() and draw() declarations; remove it.

public abstract void draw();
Comment on lines +2 to +16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant empty lines at lines 2, 5, 9, 13, and 15. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove these empty lines so the class and its members start without leading blank lines.

}
60 changes: 60 additions & 0 deletions src/main/java/core/basesyntax/FigureSupplier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove this blank line after the package statement.

import java.util.Random;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove this blank line after the import statement.

public class FigureSupplier {
private static final int FIGURE_COUNT = 5;
private static final double MIN_DIMENSION = 1;
private static final double MAX_DIMENSION = 10;
private static final double DEFAULT_RADIUS = 10;
private static final String DEFAULT_COLOR = Color.WHITE.name();
private final Random random = new Random();
private final ColorSupplier colorSupplier = new ColorSupplier();
//Circle
private final double radius = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
//Trapezoid
private final double firstLegTrapezoid = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
private final double secondLegTrapezoid = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
private final double heightTrapezoid = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
//Square
private final double side = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
//Triangle
private final double firstLegTriangle = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
private final double secondLegTriangle = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
//Rectangle
private final double widthRectangle = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
private final double heightRectangle = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);
Comment on lines +14 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist instruction: "Creating a figure, don't pass expressions in the constructor. Create separate variables and pass them on for better code readability." Random dimension values are declared as class-level final fields and computed once at object construction, so every call to getRandomFigure() will reuse the same numeric values. Move generation of random values into getRandomFigure() as local variables (e.g., double radius = random.nextDouble(MIN_DIMENSION, MAX_DIMENSION);) and then pass those locals to the Figure constructors. See the fields declared here: radius, firstLegTrapezoid, secondLegTrapezoid, heightTrapezoid, side, firstLegTriangle, secondLegTriangle, widthRectangle, heightRectangle.


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove this blank line that sits between the field declarations and the getRandomFigure() method (keep class members compact).

public Figure getRandomFigure() {
switch (random.nextInt(FIGURE_COUNT)) {
case 0 -> {
return new Circle(colorSupplier.getRandomColor(), radius);
}
case 1 -> {
return new Rectangle(colorSupplier.getRandomColor(),
widthRectangle, heightRectangle);
}
case 2 -> {
return new RightTriangle(colorSupplier.getRandomColor(),
firstLegTriangle, secondLegTriangle);
}
case 3 -> {
return new Square(colorSupplier.getRandomColor(), side);
}
case 4 -> {
return new IsoscelesTrapezoid(colorSupplier.getRandomColor(),
firstLegTrapezoid,
secondLegTrapezoid,
heightTrapezoid);
}
default -> {
return getDefaultFigure();
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove this blank line between the end of getRandomFigure() and the start of getDefaultFigure().

public Figure getDefaultFigure() {
return new Circle(DEFAULT_COLOR, DEFAULT_RADIUS);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — remove this blank line before the class closing brace.

}
8 changes: 0 additions & 8 deletions src/main/java/core/basesyntax/HelloWorld.java

This file was deleted.

30 changes: 30 additions & 0 deletions src/main/java/core/basesyntax/IsoscelesTrapezoid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)". Remove the blank line after the package declaration so the import/class begins immediately after the package statement.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line at top of file. Remove this blank line so the file does not begin class implementation with an empty line. See checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains a blank line immediately after the package statement. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line so the file does not start with an empty line after the package declaration.

public class IsoscelesTrapezoid extends Figure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line inside class (immediately after class declaration). Remove this blank line to comply with the checklist.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line right after the class declaration before the first field. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this empty line so the first field appears directly after the class opening.

private final double firstLeg;
private final double secondLeg;
private final double height;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line before constructor. Remove this blank line to comply with the checklist.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty line between the fields and the constructor. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep the constructor immediately after the field declarations.

public IsoscelesTrapezoid(String randomColor, double randomBaseA,
double randomBaseB, double randomHeight) {
super(randomColor);
this.firstLeg = randomBaseA;
this.secondLeg = randomBaseB;
this.height = randomHeight;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line before getArea() method. Remove this blank line to comply with the checklist.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line between the constructor and the overridden getArea() method. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the method follows immediately after the constructor if no grouping is intended.

@Override
public double getArea() {
return (firstLeg + secondLeg) / 2 * height;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line before draw() method. Remove this blank line to comply with the checklist.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a blank line between getArea() and the overridden draw() method. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep method implementations compact and consistent.

@Override
public void draw() {
System.out.println("Figure: isosceles trapezoid, area: " + getArea()
+ " sq. units, firstLeg: " + firstLeg
+ " units, secondLeg: " + secondLeg
+ " units, height: " + height
+ " units, color: " + getColor());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draw() method concatenates getColor() directly. The checklist requires: "Use name() for getting String representation of enum constants" when enums are used for colors. Concatenating the enum may produce uppercase enum names or rely on toString(), which is discouraged. Use getColor().name() (and call .toLowerCase() if you need lowercase output to match examples) when printing the color. Example change: "..., color: " + getColor().name().toLowerCase().

}
}
26 changes: 26 additions & 0 deletions src/main/java/core/basesyntax/Rectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with an empty line after the package declaration. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)". Remove the blank line so the class/imports start directly after the package statement .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the package statement; remove it.

public class Rectangle extends Figure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the class declaration before the first field; remove it.

private final double width;
private final double height;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between field declarations and the constructor; remove it.

public Rectangle(String randomColor, double randomWidth, double randomHeight) {
super(randomColor);
this.width = randomWidth;
this.height = randomHeight;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line after the constructor and before the @OverRide; remove it.

@Override
public double getArea() {
return width * height;
}

Comment on lines +2 to +18

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant empty lines at and after the top of the file and before class members (lines 2, 4, 7, 13, 18). This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove these empty lines so the class and its members start without leading blank lines. (See Rectangle.java: )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line before the second @Override/draw method; remove it.

@Override
public void draw() {
System.out.println("Figure: rectangle, area: " + getArea()
+ " sq. units, width: " + width
+ " units, height: " + height
+ " units, color: " + getColor());
Comment on lines +21 to +24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In draw() you print the color by concatenating getColor() directly. The checklist requires: "Use name() for getting String representation of enum constants". Please use getColor().name() (or getColor().name().toLowerCase() if lowercase output is required) to get a stable String representation of the enum constant and avoid relying on toString() behavior .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line prints the color by concatenating the enum directly: "color: " + getColor(). The checklist specifies: "Use name() for getting String representation of enum constants". Instead of relying on implicit enum string conversion, use getColor().name() (and normalize case if required), or switch to storing a String color. This ensures consistent English color output and matches checklist requirements.

}
}
26 changes: 26 additions & 0 deletions src/main/java/core/basesyntax/RightTriangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line immediately after the package declaration so the class declaration follows the package statement without an empty line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the package statement. Remove this empty line.

public class RightTriangle extends Figure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the class declaration (before the first field). Remove this empty line so the first field appears directly after the class opening.

private final double firstLeg;
private final double secondLeg;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between field declarations and the constructor. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep the class body compact.

public RightTriangle(String randomColor, double randomLegA, double randomLegB) {
super(randomColor);
this.firstLeg = randomLegA;
this.secondLeg = randomLegB;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between the constructor and the getArea() method. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep method ordering compact.

@Override
public double getArea() {
return (firstLeg * secondLeg) / 2;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line between getArea() and the draw() method. The checklist requires removal of redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to comply with style guidance.

@Override
public void draw() {
System.out.println("Figure: right triangle, area: " + getArea()
+ " sq. units, firstLeg: " + firstLeg
+ " units, secondLeg: " + secondLeg
+ " units, color: " + getColor());
}
}
23 changes: 23 additions & 0 deletions src/main/java/core/basesyntax/Square.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package core.basesyntax;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains a redundant empty line after the package declaration. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line so the class declaration follows the package immediately.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist requirement: "Don't begin class or method implementation with an empty line." Remove the empty line between the package declaration and the public class Square declaration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line immediately after the package statement; remove it.

public class Square extends Figure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line right after the class declaration before the first field; remove it.

private final double side;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between the field declaration and the constructor; remove it.

public Square(String randomColor, double randomSide) {
super(randomColor);
this.side = randomSide;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between the constructor and the @OverRide annotation for getArea(); remove it.

@Override
public double getArea() {
return Math.pow(side, 2);
}

Comment on lines +2 to +16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant empty lines at and after the top of the file and before class members (lines 2, 4, 6, 11, 16). This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove these empty lines so the class and its members start without leading blank lines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" — there is a blank line between getArea() method and the @OverRide annotation for draw(); remove it.

@Override
public void draw() {
System.out.println("Figure: square, area: " + getArea()
+ " sq. units, side: " + side
+ " units, color: " + getColor());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draw() method prints the color by concatenating getColor() (the enum instance). The checklist requires: "Use name() for getting String representation of enum constants". Use getColor().name() (or getColor().name().toLowerCase() if lowercase is required) when printing the color to avoid relying on toString() behavior.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the checklist guidance: "Use name() for getting String representation of enum constants". In draw() you print getColor() directly. Use getColor().name() (and consider .toLowerCase() to match example output like "blue") so the printed color is a proper String, e.g., ... + " color: " + getColor().name().toLowerCase().

}
}