-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
added solution #1198
base: master
Are you sure you want to change the base?
added solution #1198
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.
Hey there! 😊 Before you submit your work for review, please go through the checklist under the task and make any necessary corrections. 📝✅ Your mentor will be happy to help once those points are sorted out. Don't worry, it's all part of the learning process! 📚✨
Ball ball = lottery.getRandomBall(); | ||
Ball ball1 = lottery.getRandomBall(); | ||
Ball ball2 = lottery.getRandomBall(); | ||
System.out.println(ball); | ||
System.out.println(ball1); | ||
System.out.println(ball2); |
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.
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.
not fixed
public String getColor() { | ||
return color; | ||
} | ||
|
||
public void setColor(String color) { | ||
this.color = color; | ||
} | ||
|
||
public int getNumber() { | ||
return number; | ||
} | ||
|
||
public void setNumber(int number) { | ||
this.number = 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.
Better init using constructor
return null; | ||
|
||
public Colors getRandomColor() { | ||
int index = new Random().nextInt(Colors.values().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.
You need only one Random object and you can create it field of class
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.
not fixed
} | ||
|
||
public int getRandomNumber() { | ||
return new Random().nextInt(100); |
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.
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.
not fixed
public Ball getRandomBall() { | ||
ColorSupplier colorSupplier = new ColorSupplier(); | ||
String color1 = colorSupplier.getRandomColor().toString(); | ||
int number1 = getRandomNumber(); | ||
Ball ball = new Ball(); | ||
ball.setColor(color1); | ||
ball.setNumber(number1); | ||
return ball; |
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.
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.
not fixed
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.
Ball ball = lottery.getRandomBall(); | ||
Ball ball1 = lottery.getRandomBall(); | ||
Ball ball2 = lottery.getRandomBall(); | ||
System.out.println(ball); | ||
System.out.println(ball1); | ||
System.out.println(ball2); |
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.
not fixed
return null; | ||
|
||
public Colors getRandomColor() { | ||
int index = new Random().nextInt(Colors.values().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.
not fixed
public Ball getRandomBall() { | ||
ColorSupplier colorSupplier = new ColorSupplier(); | ||
String color1 = colorSupplier.getRandomColor().toString(); | ||
int number1 = getRandomNumber(); | ||
Ball ball = new Ball(); | ||
ball.setColor(color1); | ||
ball.setNumber(number1); | ||
return ball; |
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.
not fixed
} | ||
|
||
public int getRandomNumber() { | ||
return new Random().nextInt(100); |
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.
not fixed
No description provided.