-
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 classes: Lottery Ball Colors and ColorSupplier #1750
base: master
Are you sure you want to change the base?
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.
Great job on implementing the task requirements! 🎉 Your code meets all the core requirements, and the functionality is intact. While there are minor suggestions for improvement, such as using name()
instead of toString()
for enum constants and employing a loop for creating multiple Ball
objects, these do not impact the overall functionality. Keep up the good work, and consider these suggestions for cleaner and more maintainable code in the future! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
Ball ball1 = lottery.getRandomBall(); | ||
Ball ball2 = lottery.getRandomBall(); | ||
Ball ball3 = lottery.getRandomBall(); |
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.
Consider using a loop to create multiple Ball
objects instead of creating each one individually. This aligns with the checklist recommendation to use a loop for creating several objects of the same class. For example, you could use a for
loop to create and store the balls in an array.
return null; | ||
Random random = new Random(); | ||
int index = random.nextInt(colors.length); | ||
return colors[index].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.
Consider using colors[index].name()
instead of colors[index].toString()
to get the string representation of the enum constant. According to the checklist, using name()
is preferred because toString()
can be overridden, which might lead to unexpected results.
No description provided.