View the step-by-step solution to:

I am having an issue understanding how to design this program. I think this should be a nested If Then Else statement. Thank you!

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:"
Input colors
Display input

If color1 = red And color2 = blue Then
Display "Mixing red and blue make purple."
Sign up to view the entire interaction

Top Answer

Dear Student Please find... View the full answer

Computer Science-8369177.doc

INPUT “ Enter First Primary colors: ”,color1
INPUT “Enter Second Primary color: ,color2
PRINT “Input colors are: “,color1,color2
IF(( color1="red" and color2=”yellow” ) or...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online