Skip to content

Commit

Permalink
added fixes after review2
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhiircv committed Nov 27, 2024
1 parent b5dedbb commit 80e6bee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/java/core/basesyntax/Ball.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

public class Ball {

private String color;
private Colors color;
private int number;

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

public String getColor() {
public Colors getColor() {
return color;
}

Expand Down
13 changes: 9 additions & 4 deletions src/main/java/core/basesyntax/Lottery.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import java.util.Random;

public class Lottery {
Random random = new Random();
int randomInt = random.nextInt(100);
ColorSupplier supplier = new ColorSupplier();

public int getRandomInt() {
Random random = new Random();
int randomInt = random.nextInt(100);
return randomInt;
}

public Ball getRandomBall() {
Ball randomBall = new Ball();
randomBall.setColor(randomBall.getColor());
randomBall.setNumber(randomInt);
randomBall.setColor(supplier.getRandomColor());
randomBall.setNumber(getRandomInt());
return randomBall;
}
}

0 comments on commit 80e6bee

Please sign in to comment.