Question: Answer this question in JAVA Q4: A digital image is made up of pixels. Each pixel is a tiny square of a given color. Each
Answer this question in JAVA
Q4: A digital image is made up of pixels. Each pixel is a tiny square of a given color. Each pixel has x, y coordinates and a color. You can think of the image as being rows of pixels. The Pixel class has three instance variables Xcoordinate, Ycoordinate and color (all of type int). Also, the Pixel class has default XCOORDINATE, YCOORDINATE and DEFAULTCOLOR constants with values 0, 0, 250 respectively. The Pixel class implements the following constructors: 1. Pixel(); 2. Pixel (int size ); // Creates a pixel where Xcoordinate = Ycoordinate 3. Pixel (int Xcoordinate, int Ycoordinate ); 4. Pixel (int Xcoordinate, int Ycoordinate, int color ); 5. Pixel (Pixel otherPixel ); Write a setter method called Set to initialize each instance variables of Pixel class. Show how method Set would be used in the constructors. The body of the constructors must have only one call to method Set
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
