Skip to content

Conversation

@vorobieibogdan
Copy link

Process finished

Copy link

@okuzan okuzan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the build passes locally before creating a PR/ requesting a mentor's review. You can do this with command mvn clean package or similar (Ctrl Ctrl -> enter command)
Also, always go through the common mistakes checklist mentioned in the description
https://github.com/mate-academy/jv-lottery/blob/master/checklist.md
image

@vorobieibogdan vorobieibogdan requested a review from okuzan August 22, 2025 12:58
Copy link

@Elena-Bruyako Elena-Bruyako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Let's fix some comments

Comment on lines 5 to 10
Ball ball1 = Lottery.getRandomBall();
Ball ball2 = Lottery.getRandomBall();
Ball ball3 = Lottery.getRandomBall();
System.out.println("Ball 1: " + ball1);
System.out.println("Ball 2: " + ball2);
System.out.println("Ball 3: " + ball3);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create constant NUMBER_OF_BALLS

Suggested change
Ball ball1 = Lottery.getRandomBall();
Ball ball2 = Lottery.getRandomBall();
Ball ball3 = Lottery.getRandomBall();
System.out.println("Ball 1: " + ball1);
System.out.println("Ball 2: " + ball2);
System.out.println("Ball 3: " + ball3);
Lottery lottery = new Lottery();
for (int i = 0; i < NUMBER_OF_BALLS; i++) {
System.out.println(lottery.getRandomBall());
}

}
}

class Lottery {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create separate files for each classes

Comment on lines 7 to 8
private int number;
public Ball(Color color, int number) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private int number;
public Ball(Color color, int number) {
private int number;
public Ball(Color color, int number) {

Comment on lines 11 to 12
}
public String toString() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
public String toString() {
}
public String toString() {

class Lottery {
public static Ball getRandomBall() {
Color randomColor = Color.valueOf(ColorSupplier.getRandomColor());
int randomNumber = new Random().nextInt(100) + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numbers should be constants


class Lottery {
public static Ball getRandomBall() {
Color randomColor = Color.valueOf(ColorSupplier.getRandomColor());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorSupplier should be class-level variable

public class ColorSupplier {
public String getRandomColor() {
return null;
public static String getRandomColor() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static String getRandomColor() {
public String getRandomColor() {

return null;
public static String getRandomColor() {
Color[] colors = Color.values();
int randomIndex = new Random().nextInt(colors.length);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random should be class-level variable

# Conflicts:
#	src/main/java/core/basesyntax/Application.java
#	src/main/java/core/basesyntax/ColorSupplier.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants