-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Version1/Created working program according to task #1977
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
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,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. Remove the redundant empty line after the package declaration. The checklist notes: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 right after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove this redundant blank line (delete 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 after package declaration. The checklist requires not to begin class/method implementation with an empty line—remove this blank line so the class declaration follows the package statement directly. |
||
public class Circle extends Figure { | ||
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 the requirement that callers must be able to obtain a figure's area. The description states: "we can obtain the area of any figure and are able to draw it." You currently compute and store the area in the protected field but do not expose it via a public 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 class extends the abstract |
||
private final int 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. There is an empty line immediately 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 redundant blank line so the constructor starts without a leading 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. There's an unnecessary 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 :)" Please remove the empty line at line 5. 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. Remove this empty line so the constructor starts immediately after the field declarations (checklist: don't begin method implementation with an empty line). |
||
public Circle(int radius, String color) { | ||
this.radius = radius; | ||
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. There is an empty line between the constructor and the overridden 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 empty line so the method's @OverRide and signature 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. Redundant empty line before the @OverRide of draw(). Remove the blank line so the annotation and method start directly after the previous code block (style checklist). |
||
@Override | ||
public void draw() { | ||
System.out.println("Figure: circle, area: " + getArea() | ||
+ " sq. units, radius: " + radius | ||
+ " units, color: " + color); | ||
} | ||
|
||
Comment on lines
+10
to
+17
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 before/around the overrides and methods (lines 10 and 17). The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove these blank lines so annotations and methods start immediately without a leading 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. Redundant empty line before the @OverRide of getArea(). Remove the blank line so the annotation and method start directly after the previous code block (style checklist). |
||
@Override | ||
public float getArea() { | ||
return (float) Math.PI * (radius * radius); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 file contains a leading empty line before the enum declaration. This violates the checklist item: "Don't begin class or method implementation with an empty line." Please remove the redundant empty line so the enum declaration immediately follows the package statement. 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 after the package declaration which 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 immediately follows the package statement. 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 a redundant empty line after the package declaration. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove the empty line at line 2 so the enum starts immediately after the package statement. 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 contains a redundant empty line after the package declaration. 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 file starts directly with the enum declaration. |
||
public enum Color { | ||
BLUE, | ||
RED, | ||
GREEN, | ||
YELLOW, | ||
PURPLE, | ||
WHITE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 file contains redundant empty lines before the import and before the class. The checklist states: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove the empty lines so the package/import/class structure has no 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. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There are redundant empty lines at the top of the file (line 2). Remove unnecessary blank lines to comply with the style guidance. 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 after the package declaration (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. This file has a redundant empty line immediately after the package declaration. The checklist explicitly says: "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 import 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. This file begins with 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 the blank line after |
||
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. Another redundant blank line exists between the import and the class declaration. 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 as well. 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 another redundant blank line after the import (line 4). As above, this breaks: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this blank line to keep the file tidy. 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 import and the class declaration (line 4). 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 blank line between the import and the class declaration. Remove this empty line to satisfy the checklist requirement to avoid redundant 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. Redundant empty line between the import and the class declaration. Remove this blank line so |
||
public class ColorSupplier { | ||
private final 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 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 inside the class before the method declaration (line 7). 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 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 first member declaration. Delete this blank line so the first field ( |
||
public String getRandomColor() { | ||
return Color.values()[random.nextInt(Color.values().length)].name(); | ||
} | ||
} |
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. Remove the redundant empty line after the package declaration. The checklist says: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 a redundant empty line immediately after the package declaration. 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 so the file begins directly with the interface 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. Redundant empty line after package declaration. Per the checklist, remove the blank line so the interface declaration follows the package statement directly. |
||
public interface Drawable { | ||
void draw(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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 a redundant empty line between the package declaration and the class declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Please remove the blank line 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 violates checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the extra blank line(s) before the class declaration and any other redundant empty lines in this file. 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 the redundant 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, be careful :)". This is the blank line at 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. There is a redundant empty line immediately after the package declaration. The checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this 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. Redundant empty line after package declaration. 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 class declaration follows the package statement directly . |
||
public class Figure implements 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. There is a redundant empty line between the field declaration and 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 inside the class before the |
||
public float getArea() { | ||
Comment on lines
+3
to
+6
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. Figure currently contains |
||
return 0; | ||
Comment on lines
+6
to
+7
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 checklist requires separating conceptual behaviors: "Don't put all behavior into a single interface if the methods are conceptually different from each other." Figure currently contains the |
||
} | ||
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. Providing a default |
||
|
||
@Override | ||
public void draw() { | ||
|
||
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 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 between the annotation and method for |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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 the top / inside the class (for example the blank line after the package declaration and blank lines between members). The checklist says: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove those blank lines so class/method implementations do not start with an 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 violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There are redundant blank lines at the top and inside the class (for example lines 2, 4, 10, 13, 27, 29). Remove these unnecessary empty lines 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. This file begins with a redundant empty line after the package declaration. The checklist says: "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 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 file has a redundant empty line immediately after the package declaration. The checklist says: "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 import 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. 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 immediately after the package declaration so the class declaration follows the package statement directly. |
||
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. There is an unnecessary blank line between the import and the class declaration. Remove this empty line to conform to the checklist requirement to avoid redundant 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. 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 after the import statement so imports and class declaration are contiguous. |
||
public class FigureSupplier { | ||
private static final int MAX_FIGURE_COUNT = 5; | ||
private static final int MAX_PARAMETER = 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. There is an empty line immediately before the |
||
private static final int DEFAULT_CIRCLE_RADIUS = 10; | ||
private final ColorSupplier colorSupplier = new ColorSupplier(); | ||
private final 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 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 before the getRandomFigure() method body so the method starts immediately after the field declarations. |
||
public Figure getRandomFigure() { | ||
int randomFigure = random.nextInt(MAX_FIGURE_COUNT); | ||
int firstSide = random.nextInt(MAX_PARAMETER) + 1; | ||
int secondSide = random.nextInt(MAX_PARAMETER) + 1; | ||
int height = random.nextInt(MAX_PARAMETER) + 1; | ||
String color = colorSupplier.getRandomColor(); | ||
|
||
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 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 between local variable initialization and the switch return so the code blocks are not separated by unnecessary empty lines. |
||
return switch (randomFigure) { | ||
case 0 -> new Square(firstSide, color); | ||
case 1 -> new Rectangle(firstSide, secondSide, color); | ||
case 2 -> new RightTriangle(firstSide, secondSide, color); | ||
case 3 -> new Circle(firstSide, color); | ||
case 4 -> new IsoscelesTrapezoid(firstSide, secondSide, height, color); | ||
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 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 after the switch block (before the method closing brace) to avoid starting the next code block with an 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 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 before the getDefaultFigure() method so the method header is not preceded by an empty line. |
||
public Figure getDefaultFigure() { | ||
return new Circle(DEFAULT_CIRCLE_RADIUS, Color.WHITE.name()); | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 file begins with a blank line right 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 the redundant empty lines so the class declaration follows the package declaration immediately. 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 explicitly states: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line 2 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. There is an empty line after the package declaration. The checklist says: "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 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. There is a redundant empty line immediately 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 this 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 violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the redundant blank line after the package declaration so the class declaration follows the package statement directly. |
||
public class IsoscelesTrapezoid extends Figure { | ||
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 class extends the abstract |
||
private final int horizontalSide; | ||
private final int verticalSide; | ||
private final int height; | ||
Comment on lines
+4
to
+6
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. Field names |
||
|
||
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 the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the redundant blank line before the constructor so the constructor's declaration is not preceded by an empty line. |
||
public IsoscelesTrapezoid(int horizontalSide, int verticalSide, int height, String color) { | ||
this.horizontalSide = horizontalSide; | ||
this.verticalSide = verticalSide; | ||
this.height = height; | ||
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. There is an unnecessary blank line between the constructor and the @OverRide draw() annotation. Remove this empty line to comply with the checklist instruction not to begin method implementations with an 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 violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the redundant blank line before the @OverRide of draw() so the annotation/method start directly after the constructor. |
||
@Override | ||
public void draw() { | ||
System.out.println("Figure: rectangle, area: " + getArea() + " sq. units, horizontal 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. draw() prints the wrong figure type: it prints "Figure: rectangle,..." but this is an isosceles trapezoid. The task requires the draw output include the figure type (see example in description: "Figure: square, area: 25.0 sq. units, side: 5 units, color: blue"). Change the label to "Figure: isosceles trapezoid,...". 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() implementation prints "Figure: rectangle, ..." which is incorrect for this class. The task requires that draw output includes the correct figure type/name and follow the example structure: "Figure: square, area: 25.0 sq. units, side: 5 units, color: blue". Update this line to print the correct type (e.g., "Figure: isosceles trapezoid") and ensure commas/units/color follow the same format as other figures. This violates: "The draw output must include at least: figure type/name, area value, all figure-specific properties with units, and color."
Comment on lines
+16
to
+17
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 the printing format requirement: "Printing format in draw(): - Must include the word 'Figure: ' followed by the figure type name, 'area: sq. units' and list figure-specific parameters with units 'units', and 'color: ' similar to the provided example." The current draw() prints "Figure: rectangle, ..." which is incorrect for this class. Change the label to "Figure: isosceles trapezoid" and keep the rest of the formatting consistent (area in "sq. units", parameters in "units", then color). |
||
+ horizontalSide + " units, vertical side: " | ||
+ verticalSide + " units, height: " | ||
+ height + " units, 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. There is an extra blank line between draw() and getArea() sections. Remove this redundant empty line to satisfy the style checklist. 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 the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the redundant blank line before the @OverRide of getArea() so the annotation/method start directly after the previous method. |
||
@Override | ||
public float getArea() { | ||
return (horizontalSide + verticalSide) * (float) height / 2f; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 file contains redundant empty lines (for example 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 unnecessary blank lines so class/method definitions start without leading 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. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There is a redundant empty line at line 2. Remove it so the file doesn't start with an unnecessary 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 file begins with an empty line right after the package declaration. The checklist states: "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 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. 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 :)" Please remove the 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. 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 immediately after the package declaration so the class declaration follows the package statement directly. |
||
public class Main { | ||
private static final int MAX_FIGURES_ARRAY = 6; | ||
private static final FigureSupplier figureSupplier = new FigureSupplier(); | ||
|
||
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 the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There is an unnecessary blank line at line 6 inside the class. 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. There is an unnecessary empty line between the field declarations and 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. 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 between the class-level fields and the |
||
public static void main(String[] agr) { | ||
Figure[] figures = new Figure[MAX_FIGURES_ARRAY]; | ||
|
||
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 the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There is an unnecessary blank line at line 9 before the first loop. Remove it. 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 a redundant empty line immediately after the array creation line. Remove this blank line to conform to the checklist's instruction to avoid redundant 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. 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 after the array declaration so the |
||
for (int i = 0; i < MAX_FIGURES_ARRAY / 2; i++) { | ||
figures[i] = figureSupplier.getRandomFigure(); | ||
} | ||
for (int i = MAX_FIGURES_ARRAY / 2; i < MAX_FIGURES_ARRAY; 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. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There is an unnecessary blank line at line 16 before the final loop. Remove it. 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 second population loop and the final for-each loop. The checklist asks to remove 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. 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 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 before the final |
||
for (Figure allFigures : figures) { | ||
allFigures.draw(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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 file has 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 class starts directly after the package declaration. {@filecite 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 a redundant empty line after the package declaration. The checklist says: "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 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 file begins with an unnecessary empty line after the package declaration. Fix: remove the blank line so the file does not start an implementation with an empty line. This violates the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 the checklist item: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line immediately after the package declaration so the class declaration follows the package statement without an empty line. |
||
public class Rectangle extends Figure { | ||
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 the requirement that callers must be able to obtain the area (add public getArea()). Area is stored in a protected field but there is no public accessor. 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. This class extends the abstract |
||
private final int horizontalSide; | ||
private final int verticalSide; | ||
|
||
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. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove this redundant blank line so the constructor starts without a leading empty line. {@filecite 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 (line 6). Remove it so the constructor does not begin with an empty line. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 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 before the constructor so the constructor header starts directly after the field declarations. |
||
public Rectangle(int horizontalSide, int verticalSide, String color) { | ||
this.horizontalSide = horizontalSide; | ||
this.verticalSide = verticalSide; | ||
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. There is an empty line between the constructor and the @OverRide annotation. 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 so the method starts immediately. {@filecite 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 (line 12). Remove it so the method implementation does not start with a blank line. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 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 before the @OverRide draw() annotation so the annotation and method start immediately after the previous block. |
||
@Override | ||
public void draw() { | ||
System.out.println("Figure: rectangle, area: " + getArea() + " sq. units, horizontal side: " | ||
+ horizontalSide + " units, vertical side: " | ||
+ verticalSide + " units, 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. There is an empty line immediately before the getArea() method (line 19). Remove it to comply with: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 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 before the @OverRide getArea() annotation so the annotation and method begin directly after the previous block. |
||
@Override | ||
public float getArea() { | ||
return horizontalSide * verticalSide; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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. This violates the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove redundant empty lines so the class starts directly 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 a redundant empty line right after the package declaration. The checklist requires: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" Remove the blank line 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 file contains a redundant 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 the blank line so the file does not start the class with an 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 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 immediately after the package declaration so the class declaration follows the package statement directly. |
||
public class RightTriangle extends Figure { | ||
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 the requirement: "All figures must be able to compute their area via a getArea() behavior accessible for any figure instance." The class computes 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 class extends the abstract |
||
private final int firstLeg; | ||
private final int 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 between the field declarations and 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 follows immediately after the fields. 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 blank line between the field declarations and the constructor. 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. 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 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 before the constructor so the constructor starts directly after the field declarations. |
||
public RightTriangle(int firstLeg, int secondLeg, String color) { | ||
this.firstLeg = firstLeg; | ||
this.secondLeg = secondLeg; | ||
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. There is an extra blank line between the constructor and the overridden 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 the method follows immediately. 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 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 before the @OverRide of draw() so the annotation and method start immediately after the previous block. |
||
@Override | ||
public void draw() { | ||
System.out.println("Figure: right triangle, area: " + getArea() + " sq. units, first leg: " | ||
+ firstLeg + " units, second leg: " | ||
+ secondLeg + " units, 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. There is a redundant blank line between the draw() method and the getArea() method. The checklist says: "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. 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 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 before the @OverRide of getArea() so the annotation and method start directly after the preceding code block. |
||
@Override | ||
public float getArea() { | ||
return (float) (firstLeg * secondLeg) / 2; | ||
} | ||
} |
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 file has an 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 :)" Please remove the blank line so the class declaration follows the package line immediately. 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. Violation: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" There is a redundant empty line after the package declaration. Remove the blank line so the class starts immediately after the package statement. 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 has 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 so the import/class follows immediately. 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 after package declaration. The checklist requires not to begin class/method implementation with an empty line — remove this blank line so the class declaration follows the package statement directly. |
||
public class Square extends Figure { | ||
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 the requirement: the description states we must be able to obtain a figure's area: "we can obtain the area of any figure and are able to draw it." You currently compute and store 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. Violation: "Don't use abstract classes to set behavior for classes" — Square extends |
||
private final int 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. There is an empty line between the field declarations and 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 redundant blank line so the constructor starts directly after the fields. 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 blank line between the field declaration and 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. 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. Remove this blank line so the constructor starts immediately after the field declarations (checklist rule). |
||
public Square(int side, String color) { | ||
this.side = side; | ||
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. There is an empty line between the constructor and the overridden method. Remove this empty line to comply with the checklist: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :)" 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 constructor closing brace and 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 @OverRide of draw(). Remove the blank line so the annotation and method start directly after the previous code block (style checklist). |
||
@Override | ||
public void draw() { | ||
System.out.println("Figure: square, area: " + getArea() | ||
+ " sq. units, side: " + side | ||
+ " units, 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. There is an extra blank line between the end of draw() and 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 @OverRide of getArea(). Remove the blank line so the annotation and method start directly after the previous code block (style checklist). |
||
@Override | ||
public float getArea() { | ||
return side * side; | ||
} | ||
} |
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 file has an empty line immediately 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 :)" Please remove the blank line so the class starts directly after the package declaration.