Westonci.ca offers fast, accurate answers to your questions. Join our community and get the insights you need now. Get immediate and reliable answers to your questions from a community of experienced experts on our platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
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 using our platform. We're always here to provide accurate and up-to-date answers to all your queries. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.