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

Ball class with fields color and number created with toString() metho… #1737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ira-levch
Copy link

…d overriding

Colors enum created (5 colors)
ColorSupplier class - getRandomColor() method created Lottery class with getRandomBall() method created
In the main() method 3 balls are created using getRandomBall method of Lottery class with data output to the console

…d overriding

Colors enum created (5 colors)
ColorSupplier class - getRandomColor() method created
Lottery class with getRandomBall() method created
In the main() method 3 balls are created using getRandomBall method of Lottery class with data output to the console
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 is functional and meets the core requirements. While there are a couple of suggestions for improvement, such as using a loop to create Ball objects and modifying the Ball constructor to accept a Color type for better type safety, these are minor and do not impact the functionality. Keep up the good work and consider these enhancements for future projects! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +7 to +9
Ball ballOne = lottery.getRandomBall();
Ball ballTwo = lottery.getRandomBall();
Ball ballThree = 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 the three Ball objects. This approach is recommended in the checklist to avoid repetitive code when creating multiple instances of the same class .

color = supplier.getRandomColor();
index = new Random().nextInt(100);

Ball ball = new Ball(color, index);

Choose a reason for hiding this comment

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

Consider changing the Ball constructor to accept a Color type instead of a String for the color parameter. This will improve type safety and align with the use of the Color enum.

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