-
Notifications
You must be signed in to change notification settings - Fork 1.5k
lottety-hw-01 #1575
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
base: master
Are you sure you want to change the base?
lottety-hw-01 #1575
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package core.basesyntax; | ||
|
||
public class Ball { | ||
private String color; | ||
private int number; | ||
|
||
public Ball(String color, int number) { | ||
this.number = number; | ||
this.color = color; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Ball{" | ||
+ "color=" + color | ||
+ ", number=" + number | ||
+ '}'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||||||||||||||||
package core.basesyntax; | ||||||||||||||||||
|
||||||||||||||||||
public enum Color { | ||||||||||||||||||
RED, GREEN, BLUE, YELLOW, ORANGE, BLACK, WHITE | ||||||||||||||||||
|
RED, GREEN, BLUE, YELLOW, ORANGE, BLACK, WHITE | |
RED, | |
GREEN, | |
BLUE, | |
YELLOW, | |
ORANGE, | |
BLACK, | |
WHITE |
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,7 +1,12 @@ | ||||||
package core.basesyntax; | ||||||
|
||||||
import java.util.Random; | ||||||
|
||||||
public class ColorSupplier { | ||||||
public String getRandomColor() { | ||||||
return null; | ||||||
private Random random = new Random(); | ||||||
|
||||||
public Color getRandomColor() { | ||||||
|
public Color getRandomColor() { | |
public String getRandomColor() { |
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
Outdated
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 can create it as class-level variable
Outdated
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.
return in String type
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,14 @@ | ||||||
package core.basesyntax; | ||||||
|
||||||
import java.util.Random; | ||||||
|
||||||
class Lottery { | ||||||
|
class Lottery { | |
public class Lottery { |
Outdated
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.
Magic numbers should be avoided and replaced with named constants for better code readability. Consider creating a constant for the number 101, giving it a meaningful name that explains what it represents.
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.
fix comment
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
Outdated
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.
Save to constant
Outdated
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.
String randomColor = String.valueOf(colorSupplier.getRandomColor()); | |
String randomColor = colorSupplier.getRandomColor(); |
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.
it should be constant