diff --git a/src/main/java/core/basesyntax/Application.java b/src/main/java/core/basesyntax/Application.java index 42ed4ef868..5b7d64acbc 100644 --- a/src/main/java/core/basesyntax/Application.java +++ b/src/main/java/core/basesyntax/Application.java @@ -2,6 +2,12 @@ public class Application { public static void main(String[] args) { - // create three balls using class Lottery and print information about them in console + Lottery lottery = new Lottery(); + String[] balls = new String[3]; + for (int i = 0; i < balls.length; i++) { + balls[i] = lottery.getRandomBall(); + System.out.println(balls[i]); + } + System.out.println("Done"); } } diff --git a/src/main/java/core/basesyntax/ColorSupplier.java b/src/main/java/core/basesyntax/ColorSupplier.java index 25e8b23b15..ba96a07c24 100644 --- a/src/main/java/core/basesyntax/ColorSupplier.java +++ b/src/main/java/core/basesyntax/ColorSupplier.java @@ -1,7 +1,11 @@ package core.basesyntax; +import java.util.Random; + public class ColorSupplier { public String getRandomColor() { - return null; + int index = new Random().nextInt(DifferentColors.values().length); + DifferentColors ballColor = DifferentColors.values()[index]; + return ballColor.toString(); } }