Question: C programming. Primary Colour Mixer Objective: Develop a program that, when given two primary colours as input, returns the resulting mixture of the two colours.
C programming.
Primary Colour Mixer
Objective: Develop a program that, when given two primary colours as input, returns the resulting mixture of the two colours. The program should also identify and prompt if the user enters an invalid colour. Instructions:
The program should start by prompting the user: "First colour?"
After the user provides the first colour, prompt: "Second colour?"
Using the combination of user inputs, provide the resulting mixed colour. If the user enters the same colour twice, indicate that the result is the same as the input colour.
If an invalid colour is provided ie it's not a primary colour the user should be prompted again with the message: Colour is not a valid primary colour!!!"
The valid primary colours and their mixtures are:
Yellow Red Orange
Red Blue Violet
Blue Yellow Green
Coding Standards:
Ensure usage of the strcmp function for string comparison.
Use clear and descriptive variable names.
Ensure proper indentation and include helpful comments throughout your code.
Test your program extensively with various inputs to make sure your implementation matches the provided examples and handles edge cases.
For example: begintabularlll
& Input & Expected
hline & begintabularl
Red
Blue
endtabular & begintabularl
First colour?
Second colour?
Red and Blue mix to make Violet
endtabular
hline begintabularl
Yellow
Black
Red
endtabular & begintabularl
First colour?
Second colour?
Black is not a valid primary colour!!!
Second colour?
endtabular
hline
endtabular
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
