Skip to content

Commit

Permalink
Make code more beautifully.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kitazuka committed Nov 28, 2024
1 parent 4657b49 commit f814b15
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/main/java/core/basesyntax/Ball.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package core.basesyntax;

public class Ball {
private final String color;
private final int number;
private String color;
private int number;

public Ball(String color, int number) {
this.color = color;
this.number = number;
}

public int getNumber() {
return number;
}

public void setNumber(int number) {
this.number = number;
}

public String getColor() {
return color;
}

public void setColor(String color) {
this.color = color;
}

@Override
public String toString() {
return color + " ball №" + number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package core.basesyntax;

public enum BallColor {
public enum Color {
RED,
BLUE,
GREEN,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/ColorSupplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class ColorSupplier {
private final Random rand = new Random();

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

0 comments on commit f814b15

Please sign in to comment.