enter the size of the array... 10100 11011 00101 11100 00101 fraction of ones = 13/25 fraction of zeros = 12/25 row 0 sum = 2 row 1 sum = 4 row 2 sum = 2 row 3 sum = 3 row 4 sum = 2 row 1 has the largest row sum! col 0 sum = 3 col 1 sum = 2 col 2 sum = 4 col 3 sum = 1 col 4 sum = 3 col 2 has the largest col sum! columns win! diagonal sum is 4 diagonals rule

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
100%

How to write a program in java that ask the user to input an int size value into a 2d array, then output a table of random 0 and 1 of that size (table must be a perfect square), then output the fraction of your array that is ones and the fraction that is zeros, then output the sum for each row, the sum of colunms and which row and colunm have the largest sum, then determine if the largest row sum is greater than the largest column sum or vice versa, then output the sum of the diagonal(the diagonal starting at location [0][0] and going down to [N-1][N-1] for an array of size N) and determine if the diagonal sum is greater or equal to the largest row sum and greater than or equal to the largest column sum?

output should look similar to screen shot

 

enter the size of the array...
10100
11011
00101
11100
00101
fraction of ones =
13/25
fraction of zeros = 12/25
row 0 sum = 2
row 1 sum = 4
row 2 sum = 2
row 3 sum = 3
row 4 sum = 2
row 1 has the largest row sum!
col 0 sum = 3
col 1 sum
= 2
col 2 sum = 4
col 3 sum = 1
col 4 sum = 3
col 2 has the largest col sum!
columns win!
diagonal sum is 4
diagonals rule
Transcribed Image Text:enter the size of the array... 10100 11011 00101 11100 00101 fraction of ones = 13/25 fraction of zeros = 12/25 row 0 sum = 2 row 1 sum = 4 row 2 sum = 2 row 3 sum = 3 row 4 sum = 2 row 1 has the largest row sum! col 0 sum = 3 col 1 sum = 2 col 2 sum = 4 col 3 sum = 1 col 4 sum = 3 col 2 has the largest col sum! columns win! diagonal sum is 4 diagonals rule
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning