Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HSlawinski
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Comment on lines +9 to +11
Ball ball1 = lottery.getRandomBall();
Ball ball2 = lottery.getRandomBall();
Ball ball3 = lottery.getRandomBall();

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();

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.

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.

2 participants