-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Process finished #1263
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?
Process finished #1263
Conversation
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.
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

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.
Good job! Let's fix some comments
| 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); |
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.
create constant NUMBER_OF_BALLS
| 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 { |
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.
create separate files for each classes
| private int number; | ||
| public Ball(Color color, int number) { |
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.
| private int number; | |
| public Ball(Color color, int number) { | |
| private int number; | |
| public Ball(Color color, int number) { |
| } | ||
| public String toString() { |
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.
| } | |
| 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; |
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.
numbers should be constants
|
|
||
| class Lottery { | ||
| public static Ball getRandomBall() { | ||
| Color randomColor = Color.valueOf(ColorSupplier.getRandomColor()); |
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.
ColorSupplier should be class-level variable
| public class ColorSupplier { | ||
| public String getRandomColor() { | ||
| return null; | ||
| public static String getRandomColor() { |
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.
| public static String getRandomColor() { | |
| public String getRandomColor() { |
| return null; | ||
| public static String getRandomColor() { | ||
| Color[] colors = Color.values(); | ||
| int randomIndex = new Random().nextInt(colors.length); |
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.
Random should be class-level variable
# Conflicts: # src/main/java/core/basesyntax/Application.java # src/main/java/core/basesyntax/ColorSupplier.java
Process finished