CIS 115 All Assignments CIS 115 All Assignments | Page 8
When you mix two primary colors, you get a secondary color. Mixing yellow and blue gets you
green. Mixing red and blue gets you purple. The algorithm allows the user to enter two primary
colors and then displays the resulting secondary color. The colors entered by the user will be
validated to ensure they entered a primary color.
Begin
Declare String color1
Declare String color2
Declare String control1
Declare String control2
______ “Enter first primary color: “
Input _______
Prompt “Enter the second primary color: “
Input _________
Set control1 = “n”
DOWHILE control1 = “n”
If (color1 <> “yellow”) ______ (color1 <> “red”) _______ (color1 <> “blue”) then
Prompt “first primary color is invalid”
Input _________
Else
Set control1 = “y”
ENDO
Set control2 = “n”
DOWHILE control2 = “n”
If (color2 <> “yellow”) ______ (color2 <> “red”) _______ (color2 <> “blue”) then
Prompt “second primary color is invalid”