Question: Java Download and complete Unit8Lab1.java. Instructions are provided in the file. The method header for sum is already provided, you will have to write the

Java

Download and complete Unit8Lab1.java. Instructions are provided in the file. The method header for sum is already provided, you will have to write the headers for rowSum and colSum

A complete sample run of your program should look like this:

Here is your matrix:

1 2 3 4

5 6 7 8

9 10 11 12

Sum of all elements: 78

Which row would you like to sum? 0

The sum of row 0 is 10

Which column would you like to sum? 2

The sum of column 2 is 21

Please use this

import java.util.*; public class Unit8Lab1{ public static void main(String[] args){ int[][] nums = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; System.out.println("Here is your matrix:"); display2DArray(nums); System.out.println("Sum of all elements:"); int totalSum = sum(nums); //Display totalSum //Ask the user which row they would like to sum, then display the results //Ask the user which column they would like to sum, then display the results } public static void display2DArray(int[][] theNums){ for(int r=0; r 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!