Sum elements row by row) write a method that returns the sum of all the elements in a specified row in a matrix using the following header:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question

(Sum elements row by row) write a method that returns the sum of all the elements in a specified row in a matrix using the following header:

public static double sumRow(double [][] m, int rowIndex)

Write a test program that reads a 3-by-4 matrix and displays the sum of each row here is a sample run.

Enter a 3-by-4 matrix row by row:
1.5 2 34f
5.5 6 7 8
9.5 1 3
Sum of the elenents at row 0 is 10.5
Sum of the elements at row 1 is 26.5
Sum of the elements at row 2 is 14.5
Transcribed Image Text:Enter a 3-by-4 matrix row by row: 1.5 2 34f 5.5 6 7 8 9.5 1 3 Sum of the elenents at row 0 is 10.5 Sum of the elements at row 1 is 26.5 Sum of the elements at row 2 is 14.5
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT