Java program
Write a program that satisfies the following for 2D arrays:
1) Prompts users with this menu:
a. Create: returns an uninitialized 2D array of the size nRows, nCols
b. Fill Rand: populates the array with random ints within a range [min, max]
c. Print: displays the array on the screen
d. Set at: given row and col, overwrite the value at the given location
e. Print at: given row and col, returns and displays the value at the given location
f. Get Row: given a row#, returns and displays all elements in the row
g. Get Col: given a col#, returns and displays all elements in the col
h. Set Row: given a row#, set the row with the given user row
i. Set Col: given a col#, set the col with the given user col
j. Mean of Row: computes, returns and displays average of a given row
k. Mean of Col: computes, returns and displays average of a given col
l. Sum of All: computes, returns and displays average of the array
m. Mean of All: computes returns, and displays total of the array
n. End: Quits the program
2) Every task in (1) must be implemented as a method
3) Write a while loop to keep prompting the user for next option
4) Write a switch structure that performs the selected task
The American University of Kuwait – AUK
College of Arts and Sciences
Dept. of Computer Science and Information Systems CSIS
CSIS 130 Computer Programming II
Section 03
Fall 2016
Dr. Aaron R. Rababaah
LAB01 2D Arrays
Write a program that satisfies the following for 2D arrays:
Prompts users with this menu:
Create: returns an uninitialized 2D array of the size nRows, nCols
Fill Rand: populates the array with random ints within a range [min, max]
Print: displays the array on the screen
Set at: given row and col, overwrite the value at the given location
Print at: given row and col, returns and displays the value at the given location
Get Row: given a row#, returns and displays all elements in the row
Get Col: given a col#, returns and displays all elements in the col
Set Row: given a row#, set the row with the given user row
Set Col: given a col#, set the col with the given user col
Mean of Row: computes, returns and displays average of a given row
Mean of Col: computes, returns and displays average of a given col
Sum of All: computes, returns and displays average of the array
Mean of All: computes returns, and displays total of the array
End: Quits the program
Every task in (1) must be implemented as a method
Write a while loop to keep prompting the user for next option
Write a switch structure that performs the selected task