Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

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: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago