Question: Please complete the following program ( s ) in C CODING LANGUAGE ( NOT C + + ) , also please specify which code goes
Please complete the following programs in C CODING LANGUAGE NOT C also please specify which code goes in the colorsUtil.h file vs colorUtils.c:
In this hack you'll get some more practice writing functions that utilize passbyreference
pointers error handling and enumerated types. There are several different ways to
model colors including RGB and CMYK RGB is generally used in displays and models
a color with three values in the range corresponding to the red, green and blue
"contribution" to the color. For example, the triple corresponds to a full
red and green additive value which results in yellow. CMYK or CyanMagentaYellow
Black is a model used in printing where four colors of ink are combined to make various
colors. In this system, the four values are on the scale Write functions to convert
between these models.
Write a function to convert from an RGB color model to CMYK To convert to
CMYK you first need to scale each integer value to the range by simply
computing
and then using the following formulas:
max
Your function should have the following signature:
int rgbToCMYKint r int g int b double c double double double
Identify any and all error conditions and use the return value to indicate an error
code for no error, nonzero values for error conditions Note that one edge
case is black, when which would lead to a division by zero in the
formulas. The equivalent CMYK values are
Write a function to convert from CMYK to RGB using the following formulas.
Results should be rounded. Your function should have the following signature:
int cmykToRGBdouble c double m double y double k int int int
Identify any and all error conditions and use the return value to indicate an error
code for no error, nonzero values for error conditions
Place your prototypes and documentation in a header file named colorUtils.h
and your source in a file named colorUtils.cPlace your prototypes and documentation in a header file named colorUtils.h
and your source in a file named colorUtils.c
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
