Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; #ifndef _COLOR_HPP #define _COLOR_HPP class Color{ private: int r, g, b; public: Color(); Color(int red, int green, int blue); void set(int

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

#include

using namespace std;

#ifndef _COLOR_HPP #define _COLOR_HPP

class Color{ private: int r, g, b; public: Color(); Color(int red, int green, int blue); void set(int new_r, int new_g, int new_b); int get_red(); int get_green(); int get_blue(); void invert(); void scale(double s); void print(ostream &out); };

#endif

image text in transcribed

#include "Color.hpp"

Color::Color(){ set(0, 0, 0); }

Color::Color(int red, int green, int blue){ if(red >= 0 && red = 0 && green = 0 && blue

int Color::get_red(){ return r; }

int Color::get_green(){ return g; }

int Color::get_blue(){ return b; }

void Color::set(int new_r, int new_g, int new_b){ if(new_r >= 0 && new_r = 0 && new_g = 0 && new_b

void Color::invert(){ r = 255 - r; g = 255 - g; b = 255 - b; }

void Color::scale(double s){ if(s * r >= 0 && s * r = 0 && s * g = 0 && s * b

void Color::print(ostream &out){ out

image text in transcribed

#include "Color.hpp"

int main(){ Color c1, c2(20, 30, 40), c3(255, 255, 255), c4(100, 200, 300); cout

C+ +programming

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions