2. Write a Java program that will use a two-dimensional array and modularity to solve the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Question 1:A 90 elbow in a horizontal pipe is used to direct water flow upward at a rate of 40 kg/s. The diameter of the entire elbow is 10 cm. The elbow discharges water Ointo the atmosphere, and...
-
Use the attached "words.txt" file to store the words along with their ranks in an AVL tree. Then provide the user the option to search for any word. If the word exists the program displays the rank...
-
(10 points) Given that ry + xy = 1. 1. Find a solution of the differential equation that satisfies the initial condition y(1) = 10. Answer: y = 2. Find a solution of the differential equation that...
-
3. Given the recurrence relation: Calculate T(n) for n= 1.2.3.4.5. 12 T(n) T(n)= 3T ([n/2])+ 2m +1 T(0) 0 1 2 3 4 5 [10 pts
-
The following are common household compounds: table salt (NaCl), table sugar (sucrose), vinegar (contains acetic acid), baking soda (NaHCO3), washing soda (Na2CO3? 10H2O), boric acid (H3BO3, used in...
-
For the business you plan to start, research licensing regulations in your area and describe how they will affect your operation. a. Have you applied for a sales tax ID number? Most will not have...
-
Bernard Corporation has the following shares outstanding: 8,000 shares of \(\$ 50\) par value, six percent preferred stock and 50,000 shares of \(\$ 1\) par value common stock. The company has \(\$...
-
Baker Street Animal Clinic uses a particular serum routinely in its vaccination program. Veterinarian technicians give the injections. The standard dose is 10cc per injection, and the cost has been...
-
To Do 1 . Retrieve current information on the most recent debt issuance by your shadow firm. Several sites are available, including Standard & Poor s home page at www . standardandpoors.com....
-
3. Consider a two-product, one-person economy. This person assigns 8 hours per day to work. He can either catch fish or gather apple. He can catch one fish per hour or 2 apples per hour. his utility...
-
Why may a common strategy be used for a group of assertions affected by the same class of transaction?
-
You are the external auditor of Kiwi Tours, a company which promotes New Zealand tours to the UK and owns a chain of duty-free shops. You have been auditing the company since it was listed on the...
-
What is a statement of purpose, authority, and responsibility, and how does it improve management of the internal auditing department?
-
Excregrow Ltd was a very successful fertiliser company operating in Sussex. The company had large stocks of fertiliser held in different locations throughout the county. The annual audit for 30 June...
-
Why might planning materiality differ from the materiality level used in evaluating audit findings?
-
The figure below shows the nodes (A-1) and capacities (labelled on arcs in TB/s) of a computer network. The firm would like to know how much information can flow from node A to node I. How many...
-
The pendulum consists of two rods: AB is pin supported at A and swings only in the y-z plane, whereas a bearing at B allows the attached rod BD to spin about rod AB. At a given instant, the rods have...
-
Consider a class Movie that contains information about a movie. The class has the following attributes: The movie name The MPAA rating (e.g., G, PG, PG-13, R) The number of people who have rated this...
-
Self-Test Question 27 asked you to think of some attributes for a song object. What attributes would you want for an object that represents a play list containing many songs? Self-Test Question 27...
-
Many sports have constants embedded in their rules. For example, baseball has 9 innings, 3 outs per inning, 3 strikes in an out, and 4 balls per walk. We might encode the constants for a program...
-
Determine the current assets to total assets ratio for the commercial construction company. What insight does this give you into the companys financial operations?
-
Determine the fixed assets to net worth ratio for the commercial construction company. What insight does this give you into the companys financial operations?
-
Determine the average age of accounts payable and payable turns for the commercial construction company. Use only the material and subcontract construction costs to calculate the average of accounts...
Study smarter with the SolutionInn App