Welcome to Westonci.ca, where finding answers to your questions is made simple by our community of experts. Discover in-depth answers to your questions from a wide network of experts on our user-friendly Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
Answer:
Explanation:
The following code is written in Java. It creates a GetColors method that takes in the two parameter colors of either red, blue or yellow. It combines those colors and returns the mix of the two colors back to the user. A test case has been used in the main method and the output can be seen in the attached image below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
System.out.println(GetColors("yellow", "red"));
}
public static String GetColors(String color1, String color2) {
if (color1 == "red") {
if (color2 == "blue") {return "purple";}
else if (color2 == "yellow") {return "orange";}
else {return "red";}
} else if (color1 == "blue") {
if (color2 == "red") {return "purple";}
else if (color2 == "yellow") {return "green";}
else {return "blue";}
} else if (color1 == "yellow") {
if (color2 == "red") {return "orange";}
else if (color2 == "blue") {return "green";}
else {return "yellow";}
} else {
return "Wrong Parameters";
}
}
}

Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. We're glad you visited Westonci.ca. Return anytime for updated answers from our knowledgeable team.