I am having an issue understanding how to design this program. I think this should be a nested If Then Else statement. I know this isn't right, but I tried and I need help. Thank you!
The colors red, blue, and yellow are known as primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here:
*When you mix red and blue, you get purple.
*When you mix red and yellow, you get orange.
*When you mix blue and yellow, you get green.
Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than "red," "blue," or "yellow," the program should display an error message. Otherwise, the program should display the name of the secondary color that results.
This is what I have so far:
// Declare and Initialize primary color variables
set string color1 = red
set string color2 = blue
set string color3 = yellow
// Declare and Initialize secondary colors variables
set string color4 = purple
set string color5 = orange
set string color6 = green
set color4 = color1 + color2
set color5 = color1 + color3
set color6 = color2 = color3
// Prompt the user to enter two primary colors
Display " Enter two primary colors:"
If color1 = red And color2 = blue Then
Display "Mixing red and blue make purple."
Dear Student Please find... View the full answer