-
Couldn't load subscription status.
- Fork 1.6k
Add FigureSupplier for random figure creation #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b6be2cc
f5fc2e9
47770ee
9e8c8b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package core.basesyntax; | ||
|
|
||
| public abstract class AbstractFigure implements AreaMeasurable, Drawable { | ||
| protected String color; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line inside the class before the constructor. 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 to keep class internals compact. |
||
| public AbstractFigure(String color) { | ||
| this.color = color; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line inside the class after the constructor. 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 to keep class internals compact. |
||
| public String getColor() { | ||
| return color; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||
| package core.basesyntax; | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 package declaration and the interface declaration so the file starts immediately after the package line. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 interface starts directly after the package statement. |
||||||
| public interface AreaMeasurable { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| double getArea(); | ||||||
| } | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 redundant empty/trailing blank line at the end of the file to avoid extra empty lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an unnecessary empty line near the end of the file before the final non-commentable marker. Remove this redundant empty line to comply with the checklist instruction: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" |
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is a redundant empty line at the start of the file. It violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove unnecessary leading blank lines so the class starts immediately after the package declaration . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line between the package declaration and the class declaration. It violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove this blank line so the class declaration immediately follows the package statement. |
||
| public class Circle extends AbstractFigure { | ||
| private final double radius; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line before the constructor is redundant. 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 members are grouped without extra leading blank lines . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line right 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 directly after the field declaration. |
||
| public Circle(String color, double radius) { | ||
| super(color); | ||
| this.radius = radius; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line before the @OverRide is redundant. 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 method annotation and signature start directly after the previous member . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the getArea() method. Per 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 method implementations do not start with an empty line. |
||
| @Override | ||
| public double getArea() { | ||
| return Math.PI * radius * radius; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line before the @OverRide for draw() is redundant. The checklist says: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this empty line to comply with the style requirement . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the draw() method. The checklist says: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the draw() method starts without a preceding empty line. |
||
| @Override | ||
| public void draw() { | ||
| System.out.println("Figure: circle, area: " + getArea() | ||
| + " aq. units, radius: " + radius | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line contains the area units text: "aq. units" which is incorrect. The task examples require the printed area unit to be "sq. units" (e.g., "Figure: square, area: 25.0 sq. units, side: 5 units, color: blue"). Please change "aq. units" to "sq. units" so the output matches the required example and uses correct English wording . |
||
| + " units, color: " + getColor()); | ||
|
Comment on lines
+18
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The draw() output contains a typo in the area units: it prints "aq. units". The task requires the printed info to include the area with units as shown (example: "area: 25.0 sq. units"). Please change "aq. units" to "sq. units" to match the required output format. See the description/examples for required formatting. |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line at the top of the file should be removed. Checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove leading empty lines so the class begins immediately after the package declaration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this empty line. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" The package declaration should be directly followed by imports (no blank line). |
||
| import java.util.Random; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line is redundant and should be removed. Checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Keep the imports and class declaration without extra empty lines between them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this empty line. The import should be directly above the class declaration without an intervening blank line; the checklist asks to avoid redundant empty lines at class/method starts. |
||
| public class ColorSupplier { | ||
| private static final String[] COLORS = {"red", "blue", "green", "yellow", "black"}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create enum for Colors |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line before the class body is redundant. Checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove it so fields and methods are grouped without unnecessary spacing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this empty line between the COLORS constant and the method. The checklist: "Don't begin class or method implementation with an empty line." Keep fields and methods without unnecessary blank lines. |
||
| public String getRandomColor() { | ||
| Random random = new Random(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates a new Random on every call. Consider using a class-level Random instance instead and reusing it to avoid repeated allocations and to follow the checklist guidance: "Think about which variables should be local in the method and which should be class-level" . Example approach: add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You create a new Random instance inside the method: |
||
| int index = random.nextInt(COLORS.length); | ||
| return COLORS[index]; | ||
|
Comment on lines
+9
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently a new Random() is created inside the method on every call. This violates the checklist guidance to reuse a class-level Random instance. Please add a class-level field, e.g., |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This blank line after the package declaration should be removed. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the empty line so the interface declaration follows the package statement directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line between the package declaration and the interface declaration. This violates the checklist rule: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the interface starts immediately after the package statement. |
||
| public interface Drawable { | ||
| void draw(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant leading empty line. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove unnecessary blank lines so the class starts immediately after the package declaration . |
||
| import java.util.Random; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant empty line before the import. 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 to comply with the style requirement . |
||
| public class FigureSupplier { | ||
| private static final int FIGURE_COUNT = 5; | ||
| private static final int MAX_SIZE = 10; | ||
| private final Random random = new Random(); | ||
|
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Positive: class-level |
||
| private final ColorSupplier colorSupplier = new ColorSupplier(); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant empty line inside the class. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove unnecessary blank lines so members are grouped without extra leading lines . |
||
| // Змінено тип повернення на AbstractFigure | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inline Ukrainian comment. The checklist says: "Use only eng in messages/code: Try not to use ukr/ru messages in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove comment |
||
| public AbstractFigure getRandomFigure() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method signatures use |
||
| int figureType = random.nextInt(FIGURE_COUNT); | ||
| String color = colorSupplier.getRandomColor(); | ||
|
|
||
| return switch (figureType) { | ||
| case 0 -> new Square(color, random.nextInt(MAX_SIZE) + 1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line passes a random expression directly into the Square constructor: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The switch branches pass expressions directly into constructors, for example: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create separate method for getting random side |
||
| case 1 -> new Rectangle(color, | ||
| random.nextInt(MAX_SIZE) + 1, random.nextInt(MAX_SIZE) + 1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line passes expressions directly into the Rectangle constructor:
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue for Rectangle: inline expressions are used for both width and height. This violates the checklist item: "Creating a figure, don't pass expressions in the constructor. Create separate variables and pass them on for better code readability." Assign |
||
| case 2 -> new RightTriangle(color, | ||
| random.nextInt(MAX_SIZE) + 1, random.nextInt(MAX_SIZE) + 1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line passes expressions directly into the RightTriangle constructor:
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue for RightTriangle: inline expressions are passed into the constructor. This violates the checklist item: "Creating a figure, don't pass expressions in the constructor. Create separate variables and pass them on for better code readability." Compute |
||
| case 3 -> new Circle(color, random.nextInt(MAX_SIZE) + 1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line passes an expression into the Circle constructor: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue for Circle in the switch: |
||
| case 4 -> new IsoscelesTrapezoid(color, | ||
| random.nextInt(MAX_SIZE) + 1, | ||
| random.nextInt(MAX_SIZE) + 1, | ||
| random.nextInt(MAX_SIZE) + 1); | ||
|
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The IsoscelesTrapezoid construction uses three inline expressions (
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue for IsoscelesTrapezoid: three inline expressions are passed into the constructor. This violates: "Creating a figure, don't pass expressions in the constructor. Create separate variables and pass them on for better code readability." Assign |
||
| default -> getDefaultFigure(); | ||
| }; | ||
| } | ||
|
|
||
| // і тут теж | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This inline Ukrainian comment should be replaced with English. The checklist: "Use only eng in messages/code: Try not to use ukr/ru messages in
Comment on lines
+11
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are in-file comments written in Ukrainian (e.g., There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove comment |
||
| public AbstractFigure getDefaultFigure() { | ||
| return new Circle("white", 10); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line returns a default figure created with raw literals: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getDefaultFigure() returns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 10 is magic number, create constant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use WHITE from enum |
||
| } | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This trailing empty line after the class should be removed. 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 :)" Clean trailing blank lines to match the style guide . |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,23 @@ | |
| /** | ||
| * Feel free to remove this class and create your own. | ||
| */ | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are redundant empty lines inside the file (leading/trailing blank lines before the class/method bodies). 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 so the class and method start immediately. Notable commentable empty lines: 6, 12, 16, 20, 26. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant empty line before the class declaration. Checklist violation: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the extra blank line so the class starts immediately after the package/comment block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line before the class declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove this blank line so the class declaration immediately follows the package/comment block. |
||
| public class HelloWorld { | ||
| public static void main(String[] args) { | ||
| FigureSupplier figureSupplier = new FigureSupplier(); | ||
| AbstractFigure[] figures = new AbstractFigure[6]; // тут AbstractFigure | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line uses a magic number for the array size and contains a non-English comment. Checklist violations:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Array size is hard-coded here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6 is a magic number, create constant |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line inside the class/method. Checklist violation: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove unnecessary blank lines inside main to comply with the style requirement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line between variable setup and the loop. 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 to comply with the style guidance. |
||
| for (int i = 0; i < figures.length / 2; i++) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use one for loop to implement main method |
||
| figures[i] = figureSupplier.getRandomFigure(); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line before the second loop — remove it. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" |
||
| for (int i = figures.length / 2; i < figures.length; i++) { | ||
| figures[i] = figureSupplier.getDefaultFigure(); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line before the final for-each loop. Checklist violation: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this extra blank line to tidy up the method body. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line before the final loop — remove it. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" |
||
| for (AbstractFigure figure : figures) { | ||
| figure.draw(); // draw() є в AbstractFigure через Drawable | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This inline comment is written in Ukrainian. Checklist violation: "Use only eng in messages/code: Try not to use ukr/ru messages in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The inline comment here is in Ukrainian: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove comment |
||
| } | ||
| } | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing redundant empty line after the class. Checklist violation: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove trailing blank lines at the file end to follow the style rule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing empty line near the file end — remove it. The checklist requests: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Clean up these redundant blank lines. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line immediately after the package declaration. It violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove this redundant blank line so the class declaration follows the package declaration directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty 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 class declaration follows the package statement directly. |
||
| public class IsoscelesTrapezoid extends AbstractFigure { | ||
| private final double base1; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use numbers for naming |
||
| private final double base2; | ||
| private final double height; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the constructor is redundant. It violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove it so the constructor follows the field declarations without an extra leading blank line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is 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 directly after the field declarations. |
||
| public IsoscelesTrapezoid(String color, double base1, double base2, double height) { | ||
| super(color); | ||
| this.base1 = base1; | ||
| this.base2 = base2; | ||
| this.height = height; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the getArea() method is redundant. It 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 @OverRide and method signature start directly after the previous member. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the getArea() method. 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 so method implementations don't start with an empty line. |
||
| @Override | ||
| public double getArea() { | ||
| return (base1 + base2) / 2 * height; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the draw() method is redundant. It 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 @OverRide and draw() start immediately after the previous method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the draw() method. The checklist states: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line so the draw() method begins without a preceding empty line. |
||
| @Override | ||
| public void draw() { | ||
| System.out.println("Figure: isoscelesTrapezoid, area: " + getArea() | ||
| + " sq. units, base1: " + base1 | ||
| + " units, base2: " + base2 | ||
| + " units, height: " + height | ||
| + " units, color: " + getColor()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant empty line at the top of the file. 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 directly after the package declaration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is a redundant empty line before the class declaration. It 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 statement. |
||
| public class Rectangle extends AbstractFigure { | ||
| private final double width; | ||
| private final double height; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the constructor is redundant. The checklist requires removing leading empty lines before methods/constructors. Remove this blank line so the constructor follows the field declarations without an extra empty line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is a redundant empty line between field declarations and the constructor. It 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 constructor starts immediately after the fields. |
||
| public Rectangle(String color, double width, double height) { | ||
| super(color); | ||
| this.width = width; | ||
| this.height = height; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the @OverRide of getArea() is redundant. Per the checklist: "Don't begin class or method implementation with an empty line." Remove this blank line so the annotation and method start immediately after the constructor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is a redundant empty line just before the getArea() method. It 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 method implementation doesn't begin with an empty line. |
||
| @Override | ||
| public double getArea() { | ||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The task/checklist recommends separating conceptually different behaviors into different interfaces: "Don't put all behavior into a single interface if the methods are conceptually different from each other." Consider introducing two small interfaces (e.g., |
||
| return width * height; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the @OverRide of draw() is redundant. The checklist requires removal of such leading empty lines; please remove it so the annotation and method signature follow the previous method without an extra blank line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is a redundant empty line just before the draw() method. It 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 draw() method starts directly after the previous method. |
||
| @Override | ||
| public void draw() { | ||
| System.out.println("Figure: rectangle, area: " + getArea() | ||
| + " sq. units, width: " + width | ||
| + " units, height: " + height | ||
| + " units, color: " + getColor()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty 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 :)" Please remove this redundant blank line (line 2). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line at the top of the file. 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 immediately after the package line . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file begins with an empty line before 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 blank line so the class declaration follows the package line directly. |
||
| public class RightTriangle extends AbstractFigure { | ||
| private final double firstLeg; | ||
| private final double secondLeg; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line before the constructor (line 6). The checklist requires removing redundant empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove this blank line to comply with style rules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line before the constructor. Per 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 begins immediately after the field declarations . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the constructor. 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 constructor starts directly after the field declarations. |
||
| public RightTriangle(String color, double firstLeg, double secondLeg) { | ||
| super(color); | ||
| this.firstLeg = firstLeg; | ||
| this.secondLeg = secondLeg; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line before the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line before the getArea() override. 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 so the method annotation and signature start directly after the previous member . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the getArea() 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 getArea() method starts immediately after the constructor. |
||
| @Override | ||
| public double getArea() { | ||
| return (firstLeg * secondLeg) / 2; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line before the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant empty line before the draw() override. 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 @OverRide and method signature are contiguous with previous declarations . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an empty line immediately before the draw() 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 draw() method starts without a preceding empty line. |
||
| @Override | ||
| public void draw() { | ||
| System.out.println("Figure: rightTriangle, area: " + getArea() | ||
| + " sq. units, firstLeg: " + firstLeg | ||
| + " units, secondLeg: " + secondLeg | ||
| + " units, color: " + getColor()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package core.basesyntax; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are redundant empty lines at several places in this file (for example line 2, line 5, line 10, line 15, line 22). The checklist requires removing such empty lines: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove unnecessary blank lines to comply with the style rule . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a redundant empty line. It violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the extra blank line so the class declaration starts directly after the package declaration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line 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 :)" Please remove this blank line so the class declaration follows the package statement directly. |
||
| public class Square extends AbstractFigure { | ||
| private final double side; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the constructor is redundant. 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 members begin without an extra empty line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line before 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 the blank line so the constructor starts directly after the field declaration. |
||
| public Square(String color, double side) { | ||
| super(color); | ||
| this.side = side; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the @OverRide of getArea() is redundant. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove it to comply with the style rule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line 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 the blank line so method implementations do not start with an empty line. |
||
| @Override | ||
| public double getArea() { | ||
| return side * side; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line before the @OverRide of draw() is redundant. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove it so methods start immediately after previous members. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is an empty line before the 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 the blank line so the draw() method starts without a preceding empty line. |
||
| @Override | ||
| public void draw() { | ||
| System.out.println("Figure: square, area: " + getArea() | ||
| + " sq. units, side: " + side | ||
| + " units, color: " + getColor()); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is 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 this blank line so the class declaration follows the package statement directly.