Question: problem1:Write Java program as follows: a .Declare integer 2D array with 5 rows and 5 columns. b. Initialize the array elements to random integers between

problem1:Write Java program as follows:

a.Declare integer 2D array with 5 rows and 5 columns.

b.Initialize the array elements to random integers between 1 and 9.

c. Perform the tasks given below.

i.Display all the elements in the 2D array as a table of rows and columns.

ii.Display all the diagonal elements (the elements where row index and column index are same)

iii.Find the minimum of the first row.

iv.Find the maximum of the third column.

Use following statement to get the integer random numbers between 1-9.

int r = (int) (Math.random()*(9-1+1)) + 1;

problem2:

Write a Java program that reads 5 integers from the user and stores them in a 1D integer array. Then display the value stored in each element using a bar chart. For example, if user input 2,5,3,8 and 4 as the input values your program should display the bar chart as follows.

* *

* * * * *

* *

*

* * * * * * * *

* * * *

The steps for this program can be given as follows:

1.Declare and initialize integer array (say data) with 5 elements.

2.Take 5 integers from user and store in the data array. Use a loop statement.

3. Take each element from the data array and display asterisk marks. Use nested loop statement as follows:

for(int i=0; i<5; i++)

{

for(int j=0; j

{

System.out.print(* + \t);

}

System.out.print( );

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!