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

pieted ontine (8.1) I. To be written, tested in Java using Eclipse, and handed i

ID: 3701736 • Letter: P

Question

pieted ontine (8.1) I. To be written, tested in Java using Eclipse, and handed in on a separate sheet of paper ith printed exercises commen programs work i. TwoDArray 1. use an array initializer to create a 4 x4 array with these values 7942 6 5 18 3 5 09 71 60 2. Print the average value of each of the 4 rows "ex. Row 0 average is...". 3. Print the average value of each of the 4 columns ii. AlphabetSoup 1. Create a 4x 7 array with all the capital letters of the alphabet and the numbers 0 and 1 2. Print out the matrix of the letters (the double array) 3. Use a method to shuffle the letters (see chapter 8) 4. Print out the shuffled alphabet matri

Explanation / Answer

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Surya
*/
public class TwoDarray {
  
  
public static void main(String argv[])
{
//declaring and initializing array...
int a[][] = new int[][]{{7,9,4,2},{6,5,1,8},{3,5,0,9},{7,1,6,0}};
  
int i,j,n=4,sum=0;
//priting the average of each row...


for(i=0;i<n;i++)
{
sum=0;
for(j=0;j<n;j++)
{
sum=sum+a[i][j];//finding row sum
}
System.out.println("Row :"+i+" Average:"+sum/4.0);
}

//priting the average of each col...


for(i=0;i<n;i++)
{
sum=0;
for(j=0;j<n;j++)
{
sum=sum+a[j][i];//finding row sum
}
System.out.println("Col :"+i+" Average:"+sum/4.0);
}



}
  
}

output:

run:
Row :0 Average:5.5
Row :1 Average:5.0
Row :2 Average:4.25
Row :3 Average:3.5
Col :0 Average:5.75
Col :1 Average:5.0
Col :2 Average:2.75
Col :3 Average:4.75
BUILD SUCCESSFUL (total time: 1 second)