Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program named TwoDArray with a two-dimensional integer array. The program asks user to enter number of rows and columns for the array,

    

Write a program named TwoDArray with a two-dimensional integer array. The program asks user to enter number of rows and columns for the array, and then uses an object of class Random to fill out the array elements with some random integers between 1 and 100. The program should have the following methods: displayArray. This method should accept a two-dimensional array as its argument and print all values in the array. Each row in a separate line. .getRow Totals. This method should accept a two-dimensional array as its argument and print the total of the values in each row of the array in separate lines. getColTotals. This method should accept a two-dimensional array as its argument and print the total of the values in each column of the array in separate lines. .getRowHighest. This method should accept a two-dimensional array as its argument and print highest value in each row of the array in separate lines. .getColHighest. This method should accept a two-dimensional array as its argument and print highest value in each column of the array in separate lines. getAverage. This method should accept a two-dimensional array as its argument and print the average of all values in the array. After the program fills out the two-dimensional array with random numbers, it calls above methods in order Enter the number of rows: 3 Enter the number of columns: 4 Array elements: 16, 28, 94,73 27, 45, 34, 18 55, 23, 87,62 Total for row 1: 211 Total for row 2: 124 Total for row 3: 227 Total for column 1:98 Total for column 2: 96 Total for column 3: 215 Total for column 4: 153 Highest value in row 1:94 Highest value in row 2:45 Highest value in row 3: 87 Highest value in column 1:55 Highest value in column 2:45 Highest value in column 3: 94 Highest value in column 4: 73 Average of all values: 46.83

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

Step: 3

blur-text-image

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

Introduction To Java Programming And Data Structures Comprehensive Version

Authors: Y. Daniel Liang

12th Edition

0136520235, 978-0136520238

More Books

Students also viewed these Programming questions