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

Write java statements that do the following : . A. Declare an array alpha of 10

ID: 3608695 • Letter: W

Question

Write java statements that do the following : . A. Declare an array alpha of 10 rowsand 20 columns of type int. B. Intitialize each element of the arrayalpha to 5. C. Store 1 in the first row and 2 in the remaining rows. D. Store 5 in the first column, and the value in eachremaining column is twice the value of the previous column. E. Print the array alpha one row perline. F. Print the array alpha one columnper line. . A. Declare an array alpha of 10 rowsand 20 columns of type int. B. Intitialize each element of the arrayalpha to 5. C. Store 1 in the first row and 2 in the remaining rows. D. Store 5 in the first column, and the value in eachremaining column is twice the value of the previous column. E. Print the array alpha one row perline. F. Print the array alpha one columnper line.

Explanation / Answer

final int ROW = 10;

final int COL = 20;

//A

int[][] alpha =newint[ROW][COL];

//B

for(int row_count =0; row_count < ROW; row_count++ )

{

for(int col_count =0; col_count < COL; col_count++)

{

alpha[row_count][col_count] =5;

}

}

//C

for(int row_count =0; row_count < ROW; row_count++ )

{

for(int col_count =0; col_count < COL; col_count++)

{

if(row_count == 0)

{

alpha[row_count][col_count] =1;

}

else

alpha[row_count][col_count] =2;

}

}

//D

for(int row_count =0; row_count < ROW; row_count++ )

{

for(int col_count =0; col_count < COL; col_count++)

{

if(col_count == 0)

{

alpha[row_count][col_count] =5;

}

else

alpha[row_count][col_count] = 2 *alpha[row_count][col_count - 1];

}

}

//E

for(int row_count =0; row_count < ROW; row_count++ )

{

for(int col_count =0; col_count < COL; col_count++)

{

System.out.print(alpha[row_count][col_count]);

}

System.out.println();

}

//F

for(int col_count =0; col_count < COL; col_count++ )

{

for(int row_count =0; row_count < ROW; row_count++)

{

System.out.print(alpha[row_count][col_count]);

}

System.out.println();

}

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