Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need java code to display the following images WITH EXACT COLORS AND DIMENSION

ID: 3539407 • Letter: I

Question

i need java code to display the following images WITH EXACT COLORS AND DIMENSION JUST HOW THE IMAGE IS on imageviweir. Here the link insided quoations mark " http://people.uncw.edu/narayans/courses/csc121/summer2013/Assignment%203.html ", follow the instruction on the link. I already completed 1 and 2 so i need the code for number 3 to 8 which are checkerboard, cross, inset, quad, japanese flag, and number 8 desiging your own flag. I displayed the picture below that need to be drawn with java code.











Explanation / Answer

Here is the 8th one (Note: this can have many answers)


public static void myFlag() {


Image img = ImageViewer.getImage();


int width = img.getWidth();

int height = img.getHeight();

int radius = img.getHeight()/4;


for (int x = 0; x < width/3; x++) {

for (int y = 0; y < height/3; y++) {

img.setPixelColor(x, y, Color.RED);

}


for (int y = height/3; y <  (2 * height)/3; y++) {

img.setPixelColor(x, y, Color.WHITE);

}


for (int y = (2 * height)/3; y < height; y++) {

img.setPixelColor(x, y, Color.GREEN);

}

}

}