Statistics

Problem Statement for "ColorWheel"

Problem Statement

In art, the color wheel is a concept that divides color into three primary colors, with three secondary colors between them, creating a wheel of six colors:

The colors are Red, Orange, Yellow, Green, Blue, and Purple, in that order.

Two colors can be "Adjacent", if they're next to each other on the color wheel. They can also be "Complementary" if they're opposite each other on the color wheel.

Given two color names, color1 and color2, return "Same" if they are the same, "Adjacent" if they are adjacent, "Complementary" if they're opposite, or "None" if they are none of these.

Definition

Class:
ColorWheel
Method:
describePair
Parameters:
String, String
Returns:
String
Method signature:
String describePair(String color1, String color2)
(be sure your method is public)

Constraints

  • color1 and color2 will each be one of the six listed colors.

Examples

  1. "Red"

    "Green"

    Returns: "Complementary"

    These are across from each other.

  2. "Red"

    "Purple"

    Returns: "Adjacent"

    Since the wheel wraps around in a circular fashion, these are, of course, next to each other.

  3. "Orange"

    "Orange"

    Returns: "Same"

  4. "Yellow"

    "Blue"

    Returns: "None"

  5. "Green"

    "Blue"

    Returns: "Adjacent"

  6. "Green"

    "Purple"

    Returns: "None"

  7. "Orange"

    "Yellow"

    Returns: "Adjacent"

  8. "Purple"

    "Yellow"

    Returns: "Complementary"

  9. "Red"

    "Red"

    Returns: "Same"

  10. "Green"

    "Orange"

    Returns: "None"

  11. "Green"

    "Yellow"

    Returns: "Adjacent"

  12. "Yellow"

    "Orange"

    Returns: "Adjacent"

  13. "Orange"

    "Red"

    Returns: "Adjacent"

  14. "Blue"

    "Purple"

    Returns: "Adjacent"

  15. "Red"

    "Orange"

    Returns: "Adjacent"

  16. "Purple"

    "Red"

    Returns: "Adjacent"

  17. "Green"

    "Red"

    Returns: "Complementary"

  18. "Yellow"

    "Green"

    Returns: "Adjacent"

  19. "Yellow"

    "Purple"

    Returns: "Complementary"


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: