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
15 changes: 15 additions & 0 deletions src/main/java/core/basesyntax/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

Style violation — remove leading empty line.
This file begins the class implementation with an empty line directly after the package declaration. This violates the checklist item: "Do not start class or method implementations with an empty line; remove redundant empty lines (see checklist item 1)."
Suggestion: delete the empty line at line 2 so the class declaration follows the package declaration immediately.

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 class 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 file begins with a 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 the blank line (line 2) so the class declaration follows the package line directly.

public class Application {
public static void main(String[] args) {
FigureSupplier fs = new FigureSupplier();
Figure[] figures = new Figure[Constant.NUMBER_OF_FIGURES_TO_CREATE];
for (int i = 0; i < Constant.NUMBER_OF_FIGURES_TO_CREATE / 2; i++) {
figures[i] = fs.getRandomFigure();
figures[i + Constant.NUMBER_OF_FIGURES_TO_CREATE / 2] = fs.getDefaultFigure();
Comment on lines +7 to +9

Choose a reason for hiding this comment

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

Potential runtime error — possible null entries in the figures array when NUMBER_OF_FIGURES_TO_CREATE is odd.
The loop at lines 7-9 fills two positions each iteration using Constant.NUMBER_OF_FIGURES_TO_CREATE / 2. If Constant.NUMBER_OF_FIGURES_TO_CREATE is odd, integer division will leave at least one array slot unfilled (null). Later, the for (Figure figure : figures) loop will call figure.draw() and throw a NullPointerException.
This violates the requirement in the task: "In the main() method: - The first half of the array elements must be random figures produced by FigureSupplier.getRandomFigure(). - The second half must be default figures produced by FigureSupplier.getDefaultFigure(). - After filling the array, iterate over it and draw each figure (i.e., print its info as specified in 1.4)."
Suggested fixes:

  • Compute a local int half = Constant.NUMBER_OF_FIGURES_TO_CREATE / 2; and use it when filling the array to improve clarity.
  • Ensure Constant.NUMBER_OF_FIGURES_TO_CREATE is even (preferable), or explicitly handle the odd case (e.g., fill the last element with a default figure) so no array entry remains null before drawing.
  • Alternatively, fill the first half in one loop and the second half in a separate loop to make intent explicit and robust.
    Please update the filling logic so every array element is assigned a non-null Figure before the drawing loop.

Comment on lines +7 to +9

Choose a reason for hiding this comment

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

You use Constant.NUMBER_OF_FIGURES_TO_CREATE / 2 directly in the loop condition and again in the index calculation. The checklist states: "All magic numbers in your code should be constants." Create a named local constant (for example int half = Constant.NUMBER_OF_FIGURES_TO_CREATE / 2;) before the loop and use half in the loop and index expression to avoid the inline magic number and repeated expression.

}
for (Figure figure : figures) {
figure.draw();
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/core/basesyntax/AreaCalculator.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 file has an extra blank line immediately after the package declaration. Remove it so the interface declaration follows the package line without an empty line. This violates the code style checklist: "Do not start class or method implementations with an empty line; remove redundant empty lines (see checklist item 1)."

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 item: "Don't begin class or method implementation with an empty line." Remove the blank line so the interface declaration follows the package statement directly.

Choose a reason for hiding this comment

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

This file violates the checklist item: "Don't begin class or method implementation with an empty line.\nRemove all redundant empty lines, be careful :)" — there is an empty line immediately after the package statement. Remove that blank line so the interface declaration follows the package line directly.

public interface AreaCalculator {
double getArea();
}
22 changes: 22 additions & 0 deletions src/main/java/core/basesyntax/Circle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 immediately after the package declaration. The checklist requires: "Do not start class or method implementations with an empty line; remove redundant empty lines." Please remove the empty line so the class starts directly 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 begins the class with a blank 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 this empty line so the class declaration immediately follows the package line.

public class Circle extends Figure {
private double radius;

Choose a reason for hiding this comment

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

There's an empty line immediately before the constructor. Per 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 constructor starts without a leading empty line.

public Circle(String color, double radius) {
super(color);
this.radius = radius;
area = getArea();
Comment on lines +6 to +9

Choose a reason for hiding this comment

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

Consider calling getArea() inside draw() instead of using the stored area field. Currently the constructor assigns area = getArea(); which is fine, but if radius is ever modified after construction the stored area would be stale. Calling getArea() during drawing ensures correctness. Also consider validating the radius in the constructor (e.g., ensure > 0) to avoid invalid circle instances.

}

Choose a reason for hiding this comment

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

There's an empty line before the getArea() method. This is another violation of 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 method (and its @OverRide) directly follow the previous code.

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

Comment on lines +5 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 inside the class (lines 5, 11, 16). Per the checklist: "Do not start class or method implementations with an empty line; remove redundant empty lines." Remove these extra empty lines to match the required style.

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.

Redundant empty lines found (package -> class/constructors/methods). 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 lines at the top and between members so class and methods start without a leading blank line (currently empty lines at lines 2, 5, 11, 16).

Choose a reason for hiding this comment

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

There's an empty line right before the draw() method. This also violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this redundant empty line.

@Override
public void draw() {
System.out.println("Figure: circle, area: " + area + " sq. units, radius: "
+ radius + " units " + "color: " + color.toLowerCase());
Comment on lines +19 to +20

Choose a reason for hiding this comment

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

The draw() println concatenation lacks a comma/separator before the color label, producing output like "... units color: blue". For consistency with the task example and improved readability, include a comma and space before the color label. For example: System.out.println("Figure: circle, area: " + area + " sq. units, radius: " + radius + " units, color: " + color.toLowerCase());

}
}
12 changes: 12 additions & 0 deletions src/main/java/core/basesyntax/ColorSupplier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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 the class implementation with an empty line after the package declaration. This violates the checklist item: "Do not start class or method implementations with an empty line; remove redundant empty lines (see checklist item 1)." Please remove the blank line at line 2 so the class declaration follows the package declaration immediately.

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 right 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 import follows the package immediately.

import java.util.Random;

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 between the import and the class 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 this empty line so the class declaration directly follows the import.

public class ColorSupplier {
private static final Colors[] colors = Colors.values();

Choose a reason for hiding this comment

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

The static final field colors is a constant but its name does not follow constant naming conventions. This violates the checklist item: "Follow constant naming rules for static final constants (e.g., UPPER_SNAKE_CASE) (see checklist item 6 with linked style guide)." Rename colors to COLORS (UPPER_SNAKE_CASE) to comply with the style guide.

private final Random rg = new Random();

Comment on lines +2 to +8

Choose a reason for hiding this comment

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

Redundant empty lines found. 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 lines after the package declaration and between imports/class members so the file starts and methods don't begin with empty lines.

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 inside the class before the method. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the field declarations and methods are contiguous.

public String getRandomColor() {
return colors[rg.nextInt(Constant.NUMBER_OF_COLORS)].name();
}
}
9 changes: 9 additions & 0 deletions src/main/java/core/basesyntax/Colors.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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 the enum implementation with an empty line immediately after the package declaration. This violates the checklist item: "Do not start class or method implementations with an empty line; remove redundant empty lines (see checklist item 1)." Remove the blank line so the public enum Colors { line directly follows the package declaration.

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 empty line after the package declaration so the enum declaration 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.

There is an empty line 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 the blank line so the enum declaration directly follows the package line.

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

Choose a reason for hiding this comment

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

Remove the blank line after the package declaration. This file begins the class implementation with an empty line which violates the checklist item: "Do not start class or method implementations with an empty line; remove redundant empty lines (see checklist item 1)."
Suggestion: delete the empty line so the public class Constant follows the package declaration immediately.

Choose a reason for hiding this comment

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

Remove the empty line between the package declaration and the class. This violates the checklist item: "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 begins with a blank line immediately 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 empty line so the class declaration follows the package line without a blank line between them.

public class Constant {
public static final int NUMBER_OF_COLORS = Colors.values().length;
public static final int NUMBER_OF_FIGURES = 5;

Choose a reason for hiding this comment

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

This file is missing constants for minimum/maximum bounds used when generating random dimensions. The checklist requires that "All magic numbers in your code should be constants." Add constants such as MIN_DIMENSION and MAX_DIMENSION (double) and use them from FigureSupplier instead of calling Random.nextDouble() without scaling. See checklist: "All magic numbers in your code should be constants."

public static final int DIVISION_FOR_AREA = 2;
public static final int DEFAULT_CIRCLE_RADIUS = 10;

Choose a reason for hiding this comment

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

You have DEFAULT_CIRCLE_RADIUS (10) which is required, but the project also needs a constant for the default color. The task states: "public Figure getDefaultFigure() - this method should always return a white circle with a radius of 10." Add a constant like DEFAULT_COLOR = "white" (or define and document using Colors.WHITE.name()) so the default figure color is driven by a constant rather than a literal elsewhere. Quote from description: "public Figure getDefaultFigure() - this method should always return a white circle with a radius of 10."

public static final int NUMBER_OF_FIGURES_TO_CREATE = 6;
public static final int MAX_DIMENSION = 10;
public static final int MIN_DIMENSION = 2;
public static final String DEFAULT_COLOR = "white";
}
5 changes: 5 additions & 0 deletions src/main/java/core/basesyntax/Drawer.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.

Style violation — remove leading empty line. This file begins the interface implementation with an 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 :)" Please delete line 2 so the interface declaration follows the package declaration immediately.

Choose a reason for hiding this comment

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

Remove the empty line between the package declaration and the interface declaration. This violates the checklist item: "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.

There's an empty line 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 the blank line so the interface declaration directly follows the package line.

public interface Drawer {
void draw();
}
10 changes: 10 additions & 0 deletions src/main/java/core/basesyntax/Figure.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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 the class implementation with an 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 :)" Please remove the blank line at line 2 so the class declaration follows the package declaration immediately.

Choose a reason for hiding this comment

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

Remove the leading 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 :)". The class should start 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.

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

public abstract class Figure implements Drawer, AreaCalculator {
protected String color;
protected double area;

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 between field declarations and the constructor. This also violates: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)". Start the constructor immediately after the field declarations.

Choose a reason for hiding this comment

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

There is an unnecessary empty line before the constructor. Remove this blank line so the constructor immediately follows the field declarations, per the checklist requirement to avoid leading empty lines in classes and methods.

public Figure(String color) {
this.color = color;
}
}
41 changes: 41 additions & 0 deletions src/main/java/core/basesyntax/FigureSupplier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines". Please remove the blank line so the class declaration follows the package line immediately .

import java.util.Random;

public class FigureSupplier {
private final Random rg = new Random();
private final ColorSupplier cs = new ColorSupplier();
Comment on lines +6 to +7

Choose a reason for hiding this comment

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

The code correctly uses a default branch in the switch so the method never returns null (good). Also Random and ColorSupplier are instantiated as fields and reused (good practice per checklist). Keep that pattern when you apply the fixes above .


public Figure getRandomFigure() {
int randomNumber = rg.nextInt(Constant.NUMBER_OF_FIGURES);
String randomColor = cs.getRandomColor();
double range = Constant.MAX_DIMENSION - Constant.MIN_DIMENSION;
double radius = Constant.MIN_DIMENSION + rg.nextDouble(range);
double width = Constant.MIN_DIMENSION + rg.nextDouble(range);
double height = Constant.MIN_DIMENSION + rg.nextDouble(range);
double firstLeg = Constant.MIN_DIMENSION + rg.nextDouble(range);
double secondLeg = Constant.MIN_DIMENSION + rg.nextDouble(range);
double top = Constant.MIN_DIMENSION + rg.nextDouble(range);
Comment on lines +13 to +18

Choose a reason for hiding this comment

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

This code uses rg.nextDouble(range) which does not exist in java.util.Random and will not compile. Replace these calls with rg.nextDouble() * range, e.g. double radius = Constant.MIN_DIMENSION + rg.nextDouble() * range;. Do the same for width, height, firstLeg, secondLeg, and top so the random values are generated correctly. Keep the local-variable assignments (do not pass expressions directly to constructors) as you already do.

switch (randomNumber) {
case 0: {
return new Circle(randomColor, radius);
}
case 1: {
return new Rectangle(randomColor, width, height);
}
case 2: {
return new RightTriangle(randomColor, firstLeg, secondLeg);
}
case 3: {
return new Square(randomColor, width);
}
default: {
return new IsoscelesTrapezoid(randomColor,width, height, top);
}
}
}

Comment on lines +2 to +37

Choose a reason for hiding this comment

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

This file contains redundant empty lines. Fix per checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank lines so the class and methods do not start with an empty line (examples in this file at lines 2, 4, 8, 37).

public Figure getDefaultFigure() {
return new Circle(Constant.DEFAULT_COLOR, Constant.DEFAULT_CIRCLE_RADIUS);
Comment on lines +38 to +39

Choose a reason for hiding this comment

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

Default figure color usage: getDefaultFigure() calls new Circle(Constant.DEFAULT_COLOR, Constant.DEFAULT_CIRCLE_RADIUS) (line 35). Ensure Constant.DEFAULT_COLOR matches the task requirement of returning a white circle with color exactly "white". If you change DEFAULT_COLOR in Constant.java (recommended), this usage will then be correct.

}
}
13 changes: 13 additions & 0 deletions src/main/java/core/basesyntax/FigureWithBottomAndHeight.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 the class implementation with an 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 at line 2 so the class declaration follows the package declaration immediately.

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 immediately after the package declaration. Please remove it. This violates the checklist item: "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 begins with a blank line 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 the empty line so the class declaration follows the package line without a blank line between them.

public abstract class FigureWithBottomAndHeight extends Figure {
protected double width;
protected double height;

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 right before the constructor (line 6). Remove this leading empty line so the constructor begins without a blank line. This violates the checklist item: "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.

There's a redundant empty line between the field declarations and the constructor. Per 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 constructor follows the fields directly.

public FigureWithBottomAndHeight(String color, double width, double height) {
super(color);
this.width = width;
this.height = height;
}

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 at line 12 (before the closing brace). The checklist requests removing redundant empty lines: "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.

There's a redundant empty line before the class closing brace. Remove this blank line as requested by the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

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

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/core/basesyntax/IsoscelesTrapezoid.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.

Leading 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 declaration follows the package line immediately.

Choose a reason for hiding this comment

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

Remove the empty line right 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 :)". Start the class declaration 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 file begins with a blank line 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 the blank line so the class declaration follows the package line without an empty line.

public class IsoscelesTrapezoid extends FigureWithBottomAndHeight {
private double top;

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 between the field declaration and the constructor. The checklist requires not to begin class/method implementations with an empty line. Keep class members compact and without leading blank lines.

Choose a reason for hiding this comment

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

There is a redundant blank line before the constructor. Per 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 constructor starts without a leading blank line.

public IsoscelesTrapezoid(String color, double bottom, double heigh, double top) {

Choose a reason for hiding this comment

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

The identifier and constructor parameter heigh is misspelled and used in output. The checklist requires using English for messages/code ("Use only eng in messages/code: Try not to use ukr/ru messages in toString() or System.out.println() statements.") and the task description expects trapezoid dimensions to be represented as bases and height ("IsoscelesTrapezoid: bases and height (or a clearly defined set of dimensions sufficient to compute area; must be consistent and verifiable in code)"). Rename heigh to height everywhere (including the parent class FigureWithBottomAndHeigh) and update usages and printed labels accordingly to improve clarity and correctness .

super(color, bottom, heigh);
Comment on lines +6 to +7

Choose a reason for hiding this comment

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

Constructor parameter uses the misspelled heigh. Rename parameter to height (so the signature becomes public IsoscelesTrapezoid(String color, double bottom, double height, double top)) and update the super(...) call accordingly. This fixes the English identifier issue (checklist: "Use only eng in messages/code") and aligns with the base class field height in FigureWithBottomAndHeight.

Comment on lines +6 to +7

Choose a reason for hiding this comment

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

Constructor parameter is misspelled: heigh. Rename the parameter to height and update the super(...) call to use the renamed parameter. This improves consistency with the base class field height and overall clarity.

this.top = top;
area = getArea();
}
Comment on lines +6 to +10

Choose a reason for hiding this comment

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

Constructor parameter is named heigh (misspelled). Rename this parameter to height and update the super call to pass height. Using correct English and consistent identifiers improves readability and matches other classes that use height. This relates to the checklist guidance: "Use only eng in messages/code: Try not to use ukr/ru messages in toString() or System.out.println() statements." (apply the same principle to identifiers).


@Override
public double getArea() {
return (width + top) * height / Constant.DIVISION_FOR_AREA;
}

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 before the end of the class/methods. The checklist forbids leading empty lines in class/method implementations; tidy up any extra blank lines (e.g., line 16).

Comment on lines +11 to +16

Choose a reason for hiding this comment

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

There are extra blank lines before methods (lines around getArea/draw). Remove redundant empty lines to comply with: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

@Override
public void draw() {
System.out.println("Figure: isosceles trapezoid, area: " + area + " sq. units, width: "
+ width + " units, height: " + height + " top: " + top + " color: "
+ color.toLowerCase());
Comment on lines +18 to +21

Choose a reason for hiding this comment

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

The draw() println concatenation lacks commas/separators before top and before the color label and produces less readable output. The task requires printing all information using System.out.println() in a format similar to the example: "Figure: square, area: 25.0 sq. units, side: 5 units, color: blue". Update this string to something like: System.out.println("Figure: isosceles trapezoid, area: " + area + " sq. units, width: " + width + " units, height: " + height + " units, top: " + top + " units, color: " + color.toLowerCase());

}
}
20 changes: 20 additions & 0 deletions src/main/java/core/basesyntax/Rectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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 the class implementation with an 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 :)" Please remove the blank line so the class declaration immediately follows 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 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 declaration immediately follows the package line.

public class Rectangle extends FigureWithBottomAndHeight {

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 here before the constructor. Remove it to comply with the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

public Rectangle(String color, double bottom, double heigh) {

Choose a reason for hiding this comment

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

This Rectangle constructor uses parameters named bottom and heigh. The task expects figure-specific properties (e.g., radius for Circle, firstLeg and secondLeg for RightTriangle) so Rectangle should expose clearly named rectangle-specific fields such as width and length (or sideA/sideB). See task description: "All figures have state... each figure type can also have one or several unique properties (radius for circle, firstLeg and secondLeg for right triangle, and so on)."

Choose a reason for hiding this comment

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

Constructor parameter is named heigh (misspelled). Use height instead to match the field name and correct English spelling. Be consistent with the base class FigureWithBottomAndHeight, which uses height as the field name (see FigureWithBottomAndHeight). Renaming improves clarity and follows the project's requirement to use English in code and identifiers.

super(color, bottom, heigh);
Comment on lines +5 to +6

Choose a reason for hiding this comment

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

Constructor parameter heigh is misspelled. Use correct English identifier height to match the base class and improve readability. This aligns with the checklist instruction to use English in code: "Use only eng in messages/code:". Change the constructor signature to public Rectangle(String color, double bottom, double height) and call super(color, bottom, height);.

Comment on lines +5 to +6

Choose a reason for hiding this comment

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

Constructor parameter heigh is misspelled and inconsistent with the base class which uses height. Rename the parameter to height and update the super() call accordingly (e.g., public Rectangle(String color, double bottom, double height) { super(color, bottom, height); ... }).

area = getArea();
}

Choose a reason for hiding this comment

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

There is an extra empty line before the getArea()/@OverRide block. Remove this blank line per the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

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

Choose a reason for hiding this comment

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

There is an extra empty line before the draw() method. Remove this blank line per the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

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

Choose a reason for hiding this comment

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

The draw() output concatenation is missing a comma/clear separator before the color field which makes the output differ from the example. The task requires printing all figure info using System.out.println(). Please standardize the output to include commas and units, e.g.:
System.out.println("Figure: rectangle, area: " + area + " sq. units, width: " + width + " units, height: " + height + " units, color: " + color.toLowerCase());

}
}
24 changes: 24 additions & 0 deletions src/main/java/core/basesyntax/RightTriangle.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.

This file begins with an empty line between the package and the class declaration. The checklist explicitly requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove the redundant 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.

Leading 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". Please remove the blank line so the class declaration immediately follows the package line. See checklist for guidance.

Choose a reason for hiding this comment

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

Remove the empty line 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 :)"

Choose a reason for hiding this comment

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

This blank line after the package declaration 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 class declaration immediately follows the package line.

public class RightTriangle extends Figure {
private double firstLeg;
private double secondLeg;

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 between the field declarations and the constructor. The checklist requires not to begin method/class implementations with an empty line (same rule as above)

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 here before the constructor. Remove it per the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)"

public RightTriangle(String color, double firstLeg, double secondLeg) {
super(color);
this.firstLeg = firstLeg;
this.secondLeg = secondLeg;
area = getArea();
}

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 between the constructor and the overridden methods. The checklist forbids leading empty lines before methods — tidy up this blank line (line 13).

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 before the @Override/getArea block. Remove this blank line to comply with the checklist.

@Override
public double getArea() {
return firstLeg * secondLeg / Constant.DIVISION_FOR_AREA;
}

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 before the draw() override. Methods should not start with an empty line (checklist). Remove the blank at line 18.

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 before the draw() method. Remove this blank line to comply with the checklist.

@Override
public void draw() {
System.out.println("Figure: right triangle, area: " + area + " sq. units, firstLeg: "
+ firstLeg + " units, secondLeg: " + secondLeg + " color: " + color.toLowerCase());
Comment on lines +21 to +22

Choose a reason for hiding this comment

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

The draw() output concatenation is missing a comma/clear separator before the color field. The task requires printing all figure information in a readable format (see description). Update the println to include a comma and a space before the color and ensure 'units' and 'sq. units' are present. Example:
System.out.println("Figure: right triangle, area: " + area + " sq. units, firstLeg: " + firstLeg + " units, secondLeg: " + secondLeg + " units, color: " + color.toLowerCase());

}
}
22 changes: 22 additions & 0 deletions src/main/java/core/basesyntax/Square.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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. The checklist explicitly states: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove the redundant blank line at the top of the file 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.

Style violation — remove the leading empty line after the package declaration. The checklist states: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines." Please delete the blank line so the class declaration follows the package line immediately. (See Square.java)

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 directly after the package declaration so the class 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 file contains a blank line immediately after the package declaration. Fix per 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 class declaration follows the package line without a blank line.

public class Square extends Figure {
private double side;

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 between the field declaration and the constructor so the constructor does not begin 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 a redundant empty line before the constructor. 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 constructor starts immediately.

public Square(String color, double side) {
super(color);
this.side = side;
area = getArea();
}

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 before the getArea() method so the method does not begin 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 before the 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 starts without a leading empty line.

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

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 before the draw() method so the method does not begin 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 before the draw() method. Per 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 draw() begins immediately.

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