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

Add files via upload #1696

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

Conversation

DmytroBorysenko2004
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.

Thank you for your submission! 🎉 Your code has been reviewed and is approved to help you move forward with your learning journey. However, there are some important points to address:

  1. Ball Class:

    • The toString() method should return a string representation of the ball that includes both the actual color and the number. Replace 'color' with the actual color value from the Colors enum.
  2. Naming Conventions:

    • Ensure variable names follow Java naming conventions. For instance, variables like Ball, Ball1, Ball2, Ball3, and ColorsSupplier should be renamed to ball, ball1, ball2, ball3, and colorSupplier respectively, using camelCase.
  3. Lottery Class:

    • Avoid using static methods like getRandomBall() unless necessary. Consider creating an instance of the class instead.
    • Ensure variable names like numb and Ball start with a lowercase letter.
  4. ColorSupplier Class:

    • Optimize the getRandomColor() method by creating a single Random instance at the class level instead of creating a new one each time the method is called.
  5. Colors Enum:

    • Enum values should be in uppercase to follow Java conventions for constants.

These improvements will enhance the readability and efficiency of your code. Keep up the great work, and continue to learn from these suggestions to refine your coding skills! 🚀

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

Ball.java Outdated
Comment on lines 9 to 10
public String toString(){
return "Ball" + "color" + number;

Choose a reason for hiding this comment

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

The toString method should return a string that includes the actual color of the ball. Replace 'color' with color to use the Colors enum value, and consider adding a space or other separator between 'Ball', the color, and the number for better readability.

Lottery.java Outdated
public static Ball getRandomBall(){
Random random = new Random();
int numb = random.nextInt(100);
ColorSupplier ColorsSupplier = new ColorSupplier();

Choose a reason for hiding this comment

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

The variable name ColorsSupplier should follow camelCase naming conventions. Consider renaming it to colorSupplier.

Lottery.java Outdated
int numb = random.nextInt(100);
ColorSupplier ColorsSupplier = new ColorSupplier();
Colors color = ColorsSupplier.getRandomColor();
Ball Ball = new Ball(numb, color);

Choose a reason for hiding this comment

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

The variable name Ball should follow camelCase naming conventions. Consider renaming it to ball.

Main.java Outdated
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Ball Ball1 = Lottery.getRandomBall();

Choose a reason for hiding this comment

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

The variable name Ball1 should follow camelCase naming conventions. Consider renaming it to ball1.

Main.java Outdated
public class Main {
public static void main(String[] args) {
Ball Ball1 = Lottery.getRandomBall();
Ball Ball2 = Lottery.getRandomBall();

Choose a reason for hiding this comment

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

The variable name Ball2 should follow camelCase naming conventions. Consider renaming it to ball2.

Main.java Outdated
public static void main(String[] args) {
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.

The variable name Ball3 should follow camelCase naming conventions. Consider renaming it to ball3.

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.

Thank you for your submission! 🎉 While your code is mostly well-implemented, there are a few areas that need improvement to fully meet the task requirements:

  1. Ball Class:

    • The toString() method is not correctly implemented. It should return a string that includes both the color and number of the ball. Consider using: return "Ball: " + this.color + " " + this.number;.
  2. Lottery Class:

    • Avoid using static methods like getRandomBall(). It's recommended to instantiate objects instead.
    • Ensure variable names follow Java naming conventions. For instance, ColorsSupplier should be colorSupplier.
  3. ColorSupplier Class:

    • Instead of creating a new Random object each time getRandomColor() is called, consider creating a single Random instance at the class level for efficiency.
  4. Main Class:

    • The Ball instances should not be created using static methods. Adjust this to align with best practices.
    • Ensure variable names like Ball1, Ball2, and Ball3 start with a lowercase letter, e.g., ball1, ball2, ball3.
  5. General Issues:

    • Make sure all classes, fields, constructors, and methods have explicit access modifiers.
    • Enum values in Colors should be in uppercase to follow Java naming conventions for constants.

Despite these issues, your effort is commendable, and the decision to approve is made to help you progress in your learning journey. Please review the comments and address these points in future submissions to enhance your coding skills. Keep up the good work and continue improving! 🚀

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

Ball.java Outdated
Comment on lines 9 to 10
public String toString(){
return "Ball" + "color" + number;

Choose a reason for hiding this comment

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

The toString method does not correctly concatenate the color and number fields. It currently returns the string 'Ballcolor' followed by the number. You should use this.color and this.number to properly include the object's fields in the returned string. Consider using: return "Ball: " + this.color + " " + this.number;

Lottery.java Outdated
public static Ball getRandomBall(){
Random random = new Random();
int numb = random.nextInt(100);
ColorSupplier ColorsSupplier = new ColorSupplier();

Choose a reason for hiding this comment

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

The variable name ColorsSupplier should follow camelCase naming conventions. Consider renaming it to colorSupplier for consistency with Java naming standards.

Lottery.java Outdated
int numb = random.nextInt(100);
ColorSupplier ColorsSupplier = new ColorSupplier();
Colors color = ColorsSupplier.getRandomColor();
Ball Ball = new Ball(numb, color);

Choose a reason for hiding this comment

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

The variable name Ball should start with a lowercase letter to follow Java naming conventions. Consider renaming it to ball.

Main.java Outdated
Comment on lines 5 to 7
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.

The variable names Ball1, Ball2, and Ball3 should start with a lowercase letter to follow Java naming conventions. Consider renaming them to ball1, ball2, and ball3.

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