Question: USING C++ In this problem, you will write a simple color class. Proper color representation is necessary in a variety of applications ranging from the

USING C++

USING C++ In this problem, you will write a simple color class.Proper color representation is necessary in a variety of applications ranging fromthe design, analysis, and manufacturinjg of automobiles and aircraft, to representing and

In this problem, you will write a simple color class. Proper color representation is necessary in a variety of applications ranging from the design, analysis, and manufacturinjg of automobiles and aircraft, to representing and understanding the function of biological systems, to the analysis and understanding of climate data Member Variables: The class should have three private member variables, r, that contain the red, green, and blue components of the color g, b Constructors: The class should have the following two constructors: The default constructor should initialize all the components to 0. . A constructor that takes three int arguments representing the red, green, and blue components, respectively. This should check that all three components have values that are between 0 and 255, inclusive. If they are, then the constructor should assign the argument values to the corresponding member variables. If one or more is not, then the constructor should print out an error message, and set all member variables to the value 0. Member Functions: The class should have the following public member functions: get_r ) takes no arguments and should return the red component. get_g () takes no arguments and should return the green component. get_b) takes no arguments and should return the blue component set (int r, int g, int b) sets the value of the components to the corresponding arguments. However, ifany of the arguments is outside the range 0 to 255, then the method should print an error message and not change any ofthe component values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!