Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Object Oriented Programming Create a class called Colour. It will use rgb values that will default to 0 , 0 , 0 . Besides the

Object Oriented Programming
Create a class called Colour.
It will use rgb values that will default to 0,0,0.
Besides the constructor, write the following methods:
repr
should allow the colour to be printed like this Colour (213,145,87)
mod_red which takes a factor to add to r value
this factor may be positive or negative and will be added to the r value
make sure that this takes into account that r value must be in the range 0-255
override the addition ') operator
takes another colour (make sure of that it is a colour) and adds the r,g,b values of the two colours
make sure that this takes into account that r,g,b values must be in the range 0-255
image text in transcribed

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

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago