Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prompts the user enter an int value. Create a two dimensional array of int that size. Using a Random object, set

image text in transcribed
Write a program that prompts the user enter an int value. Create a two dimensional array of int that size. Using a Random object, set each element of your array to be either zero or one Output the array with each row on a line (see example output below) Go through all the rows of your array and find the row with the most ones. Output the index and sum of this row. (see example below). If more than one row has the most ones, you only need to output the index and sum for the first row. Go through all the columns of your array and find the column with the most ones. Output the index and sum of this column. (see example below). more than one column has the most ones, you only need to output the index and sum for the first column. For example, if the user types in 3, then you are to create a 3 by 3 array . my name is me enter the size of the array: 3 0 1 1 0 1 1 1 0 1 row 0 has the largest sum2 column 2 has the largest sum 3 my name is me enter the size of the array: 4 11 0 1 11 1 0 1 00 1 row 1 has the largest sum= 4 column 0 has the largest sun = 4 my name is me enter the size of the array: 5 11 0 0 0 1 0 0 0 0 0 01 0 1 0 000 1 0 1 0 row 4 has the largest sum3 column 0 has the largest sum 2

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

Students also viewed these Databases questions