• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

i dont understand this assignment

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
some void method in a class, that changes a RGB color by switching all of its elements in this pattern :
for example : the RGB value (0,1,2) will chage to (255,254,253) what they mean by that ?
and how can i do this without any parameters in the void() method.
 
author
Posts: 23923
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can we have some context please, perhaps a link to the document that contains the statement?

Henry
 
Dan D'amico
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:
Can we have some context please, perhaps a link to the document that contains the statement?

Henry



i cant because its in a book and i dont have a camera right now. but i will try to write it shortly.

i built a class for colors. with private variables instances and public methods.
i need that one of those methods will be a void() one.
this method needs to change one given RGB set (red,green,blue)
for example (0,1,2) and changes it to (255,254,253).
i did something like that :
public void someMethod(){
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
}
but , its that simple ? or its some kind of a mathamatical pattern .
 
Ranch Hand
Posts: 89
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the colors that we see around us are a mixture of the three primary colors red,green and blue.
In computer graphics the colors are formed by mixing the three colors mentioned above.
The intensity of each color is measured a number between 0 (don't use this color at all) to 255 (use this color to its full intensity).
For example: color(red = 0,green = 0,blue = 255) (this is just pseudo code and will not work in java I'm just using it to make the concept clear) represents blue.
color(red = 255,green = 0,blue = 255) form the color purple and so on you can form different colors by varying the intensity of each color.
Hope I helped.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan D'amico wrote:but , its that simple ? or its some kind of a mathamatical pattern .


It certainly sounds like it might be that simple, and in that case it would probably be "inverting" or "complementing" the colour (not sure of the exact term).

However, without more information, it's very difficult to say. Why don't you copy out the exact description from the book?

For example: What's this method called?

Winston
 
lowercase baba
Posts: 13056
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan D'amico wrote:and how can i do this without any parameters in the void() method.


Why do you think the method has no parameters?

void means it doesn't RETURN anything - but nothing in your rather sparse description implies you can't pass in a parameter.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic