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

<Advanced loop structure> Nested for loops to modify pictures. Write a method wh

ID: 3812162 • Letter: #

Question

<Advanced loop structure>

Nested for loops to modify pictures.

Write a method which takes a numSquares parameter and copies the calling object. The method should modify the copy by creating a checker board pattern with a number of squares in each row of the pattern is equal to the value of the numSquares parameter passed. The first, and every other square should be painted black, leaving the ‘white’ squares showing the image. The method should return the copy, leaving the original unmodified.

Example: When numSquares == 4, the image will have 4 squares (of the same height and width) in each row of the pattern, 2 black and 2 showing the previous image.

Image manipulation effects: mirror and flip (horizontal or vertical), copy (entire image or a region)

Write a method that takes no parameters and modifies the calling image, flipping it vertically.

please help me! Thanks in advance! (java programming)

original Copy

Explanation / Answer

Question description is not clear.

I am assuming that the array is a string array.

using the below program for reference, use your desired datatype 2-D Array

####################################################################################

public class Chegg_06_03_2017_02 {

   static String[][] board;

   public static void changeMethod(int numSquares) {

// creating the board of size numSquare * numSquare
       board = new String[numSquares][numSquares];

// starting with a black box

       boolean startBoxBlack = true;
       for (int i = 0; i < numSquares; i++) {

           for (int j = 0; j < numSquares; j++) {

               board[i][j] = startBoxBlack ? " Black " : " White ";

// alternating the color
               startBoxBlack = !startBoxBlack;
           }

// setting for a new column start,

           if (numSquares % 2 == 0) {
               startBoxBlack = !startBoxBlack;
           }
       }

   }

   public static void display() {
       for (int i = 0; i < board.length; i++) {
           for (int j = 0; j < board.length; j++) {
               System.out.print(board[i][j] + " ");
           }
           System.out.println();
       }
   }

   public static void main(String[] args) {

       changeMethod(5);
       display();
       System.out.println("asdasd");

       changeMethod(4);
       display();
   }
}

##################################################################################

Answer for Objective 1 should be

(0,this.getHeight())

Answer for Objective 2 should be

(this.getWidth() -1 , 0)

Since it is 100*100 check box. Assuming 100 as height and 100 as width, no of the options matches.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote