Write a program to create a two-dimensional array of integers (3 by 5) and then accept user inputs to fill the array. First: find out the column with the largest sum, and swap corresponding values in this column with the first column. Second: find out the column with the smallest sum, and swap corresponding values in this column with the last column (as following sample output shows). Hint1: if by chance, in the beginning, the column with the largest sum has happened in the first column; or the column with the smallest sum has happened in the last column: we need not touch the array and swap the values. Hint2: if by chance, in the beginning, there are more than 1 column with the same largest or smallest sum, you are free to choose either of them to do the swapping. (Use Java coding language).
Write a program to create a two-dimensional array of integers (3 by 5) and then accept user inputs to fill the array. First: find out the column with the largest sum, and swap corresponding values in this column with the first column. Second: find out the column with the smallest sum, and swap corresponding values in this column with the last column (as following sample output shows). Hint1: if by chance, in the beginning, the column with the largest sum has happened in the first column; or the column with the smallest sum has happened in the last column: we need not touch the array and swap the values. Hint2: if by chance, in the beginning, there are more than 1 column with the same largest or smallest sum, you are free to choose either of them to do the swapping. (Use Java coding language).
Step by step
Solved in 2 steps with 1 images