The Color Mixer
The colors red, blue, and yellow are known as the primary colors
because they cannot be made by mixing other colors. When you mix
two primary colors, you get a secondary color, as shown down below.
Once you have complete that task, use a repetition structure down
below.
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.
Using While Loop to execute the program until some condition is met (like having the user input a 'Y' if they want to do another or a 'N' if they want to stop).
Using For Loop to execute the program a specific number of times.
Using Do Loop to execute the program once, then check to see if it should be run again.
(Please answer this question in the flowgorithm/flow chart or Gaddis Pseudo Code (not in JAVA or PYTHON)
Here is the required program code in Flowgorithm. Save this code as a file with .fprg extension and open in Flowgorithm (if the image provided is not clear). Let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks
CODE
<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value=""/>
<attribute name="about" value=""/>
<attribute name="saved" value="2020-07-17 08:52:21 AM"/>
<attribute name="created" value="RW5pZ21hO1RJVEFOSVVNOzIwMjAtMDctMTc7MDg6NDA6MDYgQU07MjQ3OA=="/>
<attribute name="edited" value="RW5pZ21hO1RJVEFOSVVNOzIwMjAtMDctMTc7MDg6NTI6MjEgQU07MTsyNTg2"/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<comment text="declaring variables needed"/>
<declare name="color1, color2, result, choice" type="String" array="False" size=""/>
<comment text="looping"/>
<do expression="choice=="Y" || choice=="y"">
<comment text="asking and reading two colors"/>
<output expression=""Enter primary color 1:"" newline="True"/>
<input variable="color1"/>
<output expression=""Enter primary color 2:"" newline="True"/>
<input variable="color2"/>
<comment text="checking if colors are red and blue"/>
<if expression="(color1=="red" && color2=="blue") || (color1=="blue" && color2=="red")">
<then>
<comment text="red+blue is purple"/>
<assign variable="result" expression=""purple""/>
</then>
<else>
<comment text="otherwise checking if colors are red and yellow"/>
<if expression="(color1=="red" && color2=="yellow") || (color1=="yellow" && color2=="red")">
<then>
<comment text="red+yellow is orange"/>
<assign variable="result" expression=""orange""/>
</then>
<else>
<comment text="otherwise checking if colors are blue and yellow"/>
<if expression="(color1=="yellow" && color2=="blue") || (color1=="blue" && color2=="yellow")">
<then>
<comment text="yellow+blue is green"/>
<assign variable="result" expression=""green""/>
</then>
<else>
<comment text="any other input is invalid"/>
<assign variable="result" expression=""invalid input""/>
</else>
</if>
</else>
</if>
</else>
</if>
<comment text="displaying the result"/>
<output expression="result" newline="True"/>
<comment text="asking and reading choice to continue or not"/>
<output expression=""Do you want to try again? Y/N"" newline="True"/>
<input variable="choice"/>
</do>
<comment text="finishes when user enter anything other than Y or y"/>
</body>
</function>
</flowgorithm>
CODE SCREENSHOT
OUTPUT SCREENSHOT
Get Answers For Free
Most questions answered within 1 hours.