Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

In C++ Please

image text in transcribed

image text in transcribed

image 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 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, if any of the 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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago