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...
-
Air enters a constant-area duct at \(M_{1}=3, p_{1}=1 \mathrm{~atm}\), and \(T_{1}=300 \mathrm{~K}\). Inside the duct, the heat added per unit mass is \(q=3 \times 10^{5} \mathrm{~J} / \mathrm{kg}\)....
-
\(\frac{11^{3}}{11^{7}}\) Simplify the expression.
-
BONDS ISSUED AT FACE VALUE Ito Co. issued the following bonds: Date of issue and sale: ........April 1, 20-1 Principal amount: ..........$300,000 Sale price of bonds: .........100 Denomination of...
-
5./Your company is considering two mutually exclusive projects, X and Y whose costs and cash flows are shown below. Assume that the projects are equally risky, and their cost of capital is 12%. Year...
-
Dylan Reyes is the accountant for Heads Up Hat Corporation. In preparing the payroll for the semimonthly pay period ending December 15, Dylan notices that some of the year-to-date executives salaries...
-
Can you help me to solve this question . The income statement for Salt Creek Golf Club for the month ending July 31 shows Service Revenue $16,700, Salaries and Wages Expense $8,900, Maintenance and...
-
Project Description: The ever-changing world and the development of new technologies have led to the emergence of new types of leadership as well as theories to explain their nature and psychological...
-
How do modern deposit accounts incorporate advanced technological features, such as mobile banking, biometric authentication, and contactless transactions, to enhance customer convenience and...
-
A 120 kg refrigerator, 2.00 m tall and 85.0 cm wide, has its center of mass at its geometrical center. You are attempting to slide it along the floor by pushing horizontally on the side of the...
-
PPO Broadcast media sent out an article and reported that Congresswoman Mary Peters was seen leaving a hotel in the middle of the night with a man that was not her husband. She also tripped and was...
-
McDougan Associates, a U.S.-based investment partnership, borrows 80.000.000 at a time when the exchange rate is $1.3343/. The entire principal is to be repaid in three years, and interest is 6.350%...
-
Oxford Company has limited funds available for investment and must ration the funds among four competing projects. Selected information on the four projects follows: Project Investment Required...
-
a. Show that the expansion of q(x) in ascending powers of x can be approximated to 10 2x + Bx 2 + Cx 3 where B and C are constants to be found. b. Find the percentage error made in using the series...
-
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...
-
1. Brockwell left his boat to be repaired at Lake Gaston Sales. The boat contained electronic equipment and other personal items. Brockwell signed a form stating that Lake Gaston had no...
-
2. Guyan Machinery, a West Virginia manufacturing corporation, hired Albert Voorhees as a salesman and required him to sign a contract stating that if he left Guyan he would not work for a competing...
-
4. The McAllisters had several serious problems with their house, including leaks in the ceiling, a buckling wall, and dampness throughout. They repaired the buckling wall by installing I-beams to...
Study smarter with the SolutionInn App