Write a method that sums all the numbers in the major diagonal in an n * n
Question:
Write a method that sums all the numbers in the major diagonal in an n * n matrix of double values using the following header:public static double?sumMajorDiagonal(double[][] m)Write a test program that reads a 4-by-4 matrix and displays the sum of all its elements on the major diagonal. Here is a sample run:
Transcribed Image Text:
Enter a 4-by-4 matrix row by row: 1 2 3 4.0 - Enter 5 6.5 7 8 - Enter 9 10 11 12 -Enter 13 14 15 16 Sum of the elements in the major diagonal is 34.5 JEnter
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 70% (10 reviews)
Output Enter a 4by4 matrix row by row 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S...View the full answer
Answered By
JITENDRA KUMAR YADAV
Myself Jitendra kumar yadav and I am currently studying at Malviya National Institute of
Technology, Jaipur in M. Sc PHYSICS final semester. And I did my graduation at central university of Rajasthan in physics and mathematics after that I'm qualified iit jam exam for M. Sc And join MNIT jaipur. And recently I'm qualified GATE - 2020. and i m too interested into become a tutor on solutioninn and distribute the my physics knowledge among the students and help more to more needy students.
Thanks
Jitendra kumar yadav
0.00
0 Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Write a method that sums the areas of all the geometric objects in an array. The method signature is: public static double sumArea(GeometricObject[] a) Write a test program that creates an array of...
-
Write a method that takes as input a binary search tree, T, and two keys k1 and k2, which are ordered so that k1 k2, and prints all elements X in the tree such that k1 Key(X) k2. Do not assume any...
-
Write a method that returns a random number between 1 and 54, excluding the numbers passed in the argument. The method header is specified as follows: public static int getRandom(int... numbers)
-
Suppose that the magnetic field in some region has the form B = kzx (where k is a constant). Find the force on a square loop (side a), lying in the yz plane and centered at the origin, if it carries...
-
Given subspaces H and K of a vector space V, the sum of H and K, written as H + K, is the set of all vectors in V that can be written as the sum of two vectors, one in H and the other in K; that is,...
-
A student uses a digital balance to determine the mass of an object. Its digital display reads 2.635 g. He keeps looking at the balance and it stays fixed at 2.635 g for half an hour. He then states,...
-
Given the background reading, list three verbal deception and three non-verbal deception cues that you believe that Aldrich Ames might exhibit and describe why
-
The following data were taken from the records of Blumbey Manufacturing Company for the fiscal year ended June 30, 2012. Instructions(a) Prepare a cost of goods manufactured schedule. (Assume all raw...
-
Company EJ plans to build a new plant to manufacture bicycles. EJ sells its bicycles in the world market for $400 per bike. It could locate the plant in Province P, which levies a 20 percent tax on...
-
You recently met Susan Taylor at a cocktail party. As a result of your conversation with her, Susan has come to you for tax advice. She wants to know how her income will be taxed. She also wants to...
-
Write a method that returns the sum of all the elements in a specified column in a matrix using the following header:public static double?sumColumn(double[][] m,?int?columnIndex)Write a test program...
-
The two-dimensional arrays m1 and m2 are strictly identical if their corresponding elements are equal. Write a method that returns true if m1 and m2 are strictly identical, using the following...
-
What is DoS? Give an example.
-
QUESTION 40 In preparing the business activity statement (BAS) for the period July to September 2020, the following information is supplied. Total sales that are taxable supplies (including GST):...
-
I started a nonprofit 10 years ago. We finally made a profit, so there is money left at the end of this fiscal year. As the founder, I used my own money to originally invest in the nonprofit. The...
-
John incurred a number of expenses in relation to his legal practice and investment property for the current tax year ended 30 June: He paid $1,200 in borrowing expenses in the current tax year to...
-
Bill owns 960 shares of ABC Corp. They are currently 18,302 shares outstanding, with a share price of $18. They have an EBIT of $29,690, which is expected to remain constant forever. The cost of debt...
-
Mt. Carmel Mines Ltd has $1,000,000 of debt, $300,000 of preference shares, and a sum of S18, 000,000 of ordinary equity. The company's after-tax cost of debt is 5.25%, preference. shares have a cost...
-
Grass Security, which began operations in 2017, invests in long-term available-for-sale securities. Following is a series of transactions and events determining its long-term investment activity....
-
Funds are separate fiscal and accounting entities, each with its own self-balancing set of accounts. The newly established Society for Ethical Teachings maintains two funds-a general fund for...
-
All Java Exceptions are ____________. a. Errors b. Omissions c. Throwables d. RunTimeExceptions
-
Which of the following statements is true? a. Exceptions are more serious than Errors. b. Errors are more serious than Exceptions. c. Errors and Exceptions are different but equally serious. d....
-
The method that ends the current application and returns control to the operating system is ____________. a. System.exit() b. System.done() c. System.end() d. System.abort()
-
Link to Digital Profile/Portfolio 2. You are taking a database snapshot of your RDS instance. What would be the impact to the I/O operations while taking snapshots? 3. What is the maximum size of RDS...
-
Define Divide and Conquer Run the simulation of merge sort in: https://www.hackerearth.com/practice/algorithms/sorting/merge-sort/visualize/ (not a question) Explain the algorithm of merge sort? Does...
-
Ask a non-IT person (your friend, child) how the Web is different from the Internet. Quote the most interesting part of their answer and then critique it based on what you know. Explain the process...
Study smarter with the SolutionInn App