Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ program Problem B: A Simple Color Class (20 points) In this problem, you will write a simple color class. Proper color representation is necessary

c++ program

image text in transcribedimage text in transcribedimage text in transcribed

Problem B: A Simple Color Class (20 points) 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 manufacturing 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 crror message, and set all member variables to the value O Member Functions: The class should have the following public member functions: get-r ( ) takes no arguments and should return the red component. qet_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, if any ofthe arguments is outside the range 0 to 255, then the method should print an error message and not change any of the component values 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago