014-003-003
Factory Method: Color Class
Easy
Problem Description
Factory method: Color class
In this problem, you will create a program that implements a Color class with static factory methods, receives a color name as input, and displays the corresponding RGB values to standard output.
Learning Objective: Understand object creation pattern using static factory methods
Implement static factory methods in Color class to return predefined color objects.
Input
Line 1: Color name (red, green, or blue)
Output
Color: [color name]
RGB: ([r], [g], [b])
```java
*red=(255,0,0), green=(0,255,0), blue=(0,0,255).
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up