Question: Solve on java programing language Question 2: (a) In computer graphics, pixels are little dots that make up the image. We will define a pixel

Solve on java programing language Solve on java programing language Question 2: (a) In computer graphics, pixels

Question 2: (a) In computer graphics, pixels are little dots that make up the image. We will define a pixel with two elements: level of brightness which is an integer between 0 and 255. 1) a color which might be either red, blue, or green. 2) Write a class in java with the name Pixel as follows: 1. Define the attributes of the class to be private. Use the default values: 0 for the brightness and "red" for the color. 2. Define the default constructor. 3. Define getters and setters for the private attributes. 4. Define the method incBrightness as follows. The method should increment the brightness level by the parameter amount. The parameter amount can be negative, in that case the brightness should be decreased. public void incBrightness( int amount) 5. Override the toString method of the class such that it returns the following. Brightness: 433, Color: red (b) Write the tester class, Tester, in which you define the main method such that you do the following Create two pixels with the following values. 1. |Brightness Color | 100 P1 Red Green P2 244 Increase the brightness of pixel p2 by 100 2. 3. Change the color of pixel p1 to Blue. 4. Print the sum of brightness of both p1 and p2 Decrement the brightness of p1 by 50 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!