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
-
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
-
Sulfites (compounds containing the SO32+ ions) are used as preservatives in dried fruit and vegetables and in wine making. In an experiment to test the presence of sulfite in fruit, a student first...
-
Ripley Corporation's accumulated depreciation-furniture account increased by $11,575, while $2,500 of patent amortization was recognized between balance sheet dates. There were no purchases or sales...
-
Consider the problem min x1+x2 s.t. h(x) = x2 x3 = 0, - - h2(x) = x2 = 0,
-
Brittany Callihan sold stock (basis of $184,000) to her son, Ridge, for $160,000, the fair market value. a. What are the tax consequences to Brittany? b. What are the tax consequences to Ridge if he...
-
As a financial analyst, can you explain what causes sluggish car sales. For example, could it be triggered by rising interest rates and/or are people putting off buying cars these days for other...
-
Reward systems are often regarded as a key approach to ensuring a results oriented outcome to strategy execution. Pay-for-performance evaluation systems are typically thought of as an effective...
-
Use the most current information in the https://datatools.ahrq.gov/hcupnet#setup database to answer the following questions. What are the nationwide average length of hospital stay and average...
-
There are three errors on the below trust account bank statement. Identify and label these: Click the 'Add a Label' Button or click anywhere on the image to add a Label Add a Label 3/3 Labels...
-
ANALYTICS (5%) For each platform, outline how you will measure analytics and include which metrics you will be measuring to track success? Set benchmarks for each platform's metrics.
-
In Lehr v. Robertson, the United States Supreme Court suggested for the first time that the United States Constitution imposes limits on the power of the states to terminate the parental rights of...
-
The intention of this assignment is to give you exposure to a professional in a career of your interest. My hope is that you can learn 'the day in the life' of a person in this career path and...
-
Read the following MCQs and give answers: 1. A bond with a coupon rate of 6.5% (assume it is paid once annually), maturing in 10 years at a value of $1,000 and a current market price of $695, will...
-
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...
-
The change in the annual spending rate, in conjunction with the boards expectations regarding future enrollment and the need for endowment support, could justify that KUEs target weight for: A....
-
Which of the characteristics put forth by Chaterji to describe the factor-based approach is/are correct? A. Only Characteristic 1 B. Only Characteristic 2 C. Both Characteristic 1 and Characteristic...
-
Based on Exhibits 1 and 2, to attempt to profit from the short-term excess return forecast, Capara should increase KUEs portfolio allocation to: A. developed markets equity and decrease its...
Study smarter with the SolutionInn App