From f453c2389a36762fbcd1b605ef9e606017b49a51 Mon Sep 17 00:00:00 2001 From: Mizuo Date: Thu, 2 Jan 2025 19:16:51 +0100 Subject: [PATCH] checksyntax --- src/main/java/core/basesyntax/Circle.java | 2 -- src/main/java/core/basesyntax/ColorSupplier.java | 2 +- src/main/java/core/basesyntax/FigureSupplier.java | 4 ++-- src/main/java/core/basesyntax/Main.java | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/core/basesyntax/Circle.java b/src/main/java/core/basesyntax/Circle.java index 3952d9b5d..a8d7a2f49 100644 --- a/src/main/java/core/basesyntax/Circle.java +++ b/src/main/java/core/basesyntax/Circle.java @@ -1,7 +1,5 @@ package core.basesyntax; -import java.lang.Math; - public class Circle extends Figure implements FigureMethods { private final float radius; diff --git a/src/main/java/core/basesyntax/ColorSupplier.java b/src/main/java/core/basesyntax/ColorSupplier.java index 6b47efd79..610139ff9 100644 --- a/src/main/java/core/basesyntax/ColorSupplier.java +++ b/src/main/java/core/basesyntax/ColorSupplier.java @@ -3,7 +3,7 @@ import java.util.Random; public class ColorSupplier { - private final static Random picker = new Random(); + private static final Random picker = new Random(); public static Colors getRandomColor() { return Colors.values()[picker.nextInt(Colors.values().length)]; diff --git a/src/main/java/core/basesyntax/FigureSupplier.java b/src/main/java/core/basesyntax/FigureSupplier.java index e7edb72ee..44ceaeacd 100644 --- a/src/main/java/core/basesyntax/FigureSupplier.java +++ b/src/main/java/core/basesyntax/FigureSupplier.java @@ -3,10 +3,10 @@ import java.util.Random; public class FigureSupplier extends ColorSupplier { - private final static Random picker = new Random(); + private static final Random picker = new Random(); public static Figure getRandomFigure() { - return switch(picker.nextInt(4)) { + return switch (picker.nextInt(4)) { case 0 -> new Circle(getRandomColor(), picker.nextInt(1, 50)); case 1 -> new Rectangle(getRandomColor(), picker.nextInt(1, 50), picker.nextInt(1, 50)); case 2 -> new RightTriangle(getRandomColor(), picker.nextInt(1, 50), picker.nextInt(1, 50)); diff --git a/src/main/java/core/basesyntax/Main.java b/src/main/java/core/basesyntax/Main.java index 23893c824..786c534ff 100644 --- a/src/main/java/core/basesyntax/Main.java +++ b/src/main/java/core/basesyntax/Main.java @@ -8,11 +8,11 @@ public static void main(String args[]) { public static Figure[] listOfRandomFigures() { Figure[] array = new Figure[6]; - for(int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { array[i] = FigureSupplier.getRandomFigure(); } - for(int i = 3; i < 6; i++) { + for (int i = 3; i < 6; i++) { array[i] = FigureSupplier.getDefaultFigure(); } @@ -20,7 +20,7 @@ public static Figure[] listOfRandomFigures() { } public static void printArray() { - for(Figure i : listOfRandomFigures()) { + for (Figure i : listOfRandomFigures()) { i.draw(); } }