import java.util.Random;
import java.util.Scanner;
public class RandomColorPicker {
public static void main(String[] args) {
// Array of colors
String[] colors = {"Red", "Green", "Blue", "Yellow"};
// Create a Random object
Random random = new Random();
// Pick a random color from the array
String randomColor = colors[random.nextInt(colors.length)];
// Display the picked color
System.out.println("Do you like the color " + randomColor + "? (yes/no)");
// Create a Scanner object for user input
Scanner scanner = new Scanner(System.in);
// Get the user's response
String response = scanner.nextLine();
// Respond based on user's input
if (response.equalsIgnoreCase("yes")) {
System.out.println("Great! " + randomColor + " is a cool color.");
} else if (response.equalsIgnoreCase("no")) {
System.out.println("Oh no! Maybe you'll like another color.");
} else {
System.out.println("I didn't understand your answer, but colors are fun!");
}
// Close the scanner
scanner.close();
}
}