Question: 2. Write a Java program that will use a two-dimensional array and modularity to solve the following tasks: 1. Create a method to generate

2. Write a Java program that will use a two-dimensional array and 

2. Write a Java program that will use a two-dimensional array and modularity to solve the following tasks: 1. Create a method to generate a 2-dimensional array (random numbers, range 0 - 500). The array has ROW rows and COL columns, where ROW and COL are class constants. 2. Create a method to print the array. 3. Create a method to find the largest element in the array 4. Create a method to find the smallest element in the array 5. Create a method to find the sum of all elements in the array Generate output similar to the sample output below. Sample Output: The array elements are: 72 353 281 223 426 188 415 391 197 214 357 285 129 381 146 219 384 433 5 487 52 27 317 152 327 33 113 356 155 76 153 409 381 303 43 254 393 399 149 428 84 67 370 205 161 114 433 466 262 262 157 376 266 368 435 432 359 3 57 256 273 147 5 440 174 176 208 224 79 348 276 361 107 451 379 140 294 150 14 214 428 380 78 83 249 420 433 224 337 189 48 166 425 42 311 191 487 498 144 283 172 248 193 75 451 143 126 26 362 230 318 207 88 308 120 145 210 399 203 332 41 345 142 129 418 198 104 83 456 32 145 343 382 52 27 446 499 434 450 74 149 468 421 73 165 466 157 480 160 135 Second row elements are: 219 384 152 327 33 76 381 303 43 254 393 399 149 428 84 Third column elements are: 281 152 113 262 5 150 311 498 172 75 Range of values/array: 3 - 499 The sum of all elements/array - 36631 The average of all elements/array = 244.21

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 Programming Questions!