Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions