Complete the following methods with the given signatures. All user input and output must occur in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Complete the following methods with the given signatures. All user input and output must occur in your main method. For this program, you may use Scanner or JOptionPane. In your main method, display a menu to ask the user for their desired task. The options are listed below. Once the user chooses a task, ask them for their desired number of rows and number of columns. Then, prompt them to fill the array with integer values. When displaying an array, all entries must be displayed row-by-row (see below for sample output). When the process is complete, ask the user if they want to do it again. public static int sumOfRow (int ( ) ( ) arr, int row) This method takes both an integer matrix and an integer as parameters and returns the sum of the elements in that row. public static double averageOfRows (int[]) [] arr) This method takes an integer matrix as a parameter and returns the average of each row in the matrix. public static int largest Row (int () () arr) This method takes an integer matrix as a parameter and returns the row index with the largest sum. Example runs of the program: 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 1 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3. Enter element 0, 1: 4 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 3 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3 Enter element 0, 1: 4 Enter element 0, 2: 12 Enter element 0, 2: 12 Enter element 1, 0: 19 Enter element 1, 1: Enter element 1, 2: 0 You entered: -3 4 12 19-80 Enter row: 1 -8 The sum of row 1 is 11. Again? (1 for yes, 2 for no): 1 Enter element 1, 0: 19 Enter element 1, 1: -8 Enter element 1, 2: 0 You entered: -3 4 12 19-8 0 The row with the largest sum is row 0. Again? (1 for yes, 2 for no): 1 Complete the following methods with the given signatures. All user input and output must occur in your main method. For this program, you may use Scanner or JOptionPane. In your main method, display a menu to ask the user for their desired task. The options are listed below. Once the user chooses a task, ask them for their desired number of rows and number of columns. Then, prompt them to fill the array with integer values. When displaying an array, all entries must be displayed row-by-row (see below for sample output). When the process is complete, ask the user if they want to do it again. public static int sumOfRow (int ( ) ( ) arr, int row) This method takes both an integer matrix and an integer as parameters and returns the sum of the elements in that row. public static double averageOfRows (int[]) [] arr) This method takes an integer matrix as a parameter and returns the average of each row in the matrix. public static int largest Row (int () () arr) This method takes an integer matrix as a parameter and returns the row index with the largest sum. Example runs of the program: 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 1 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3. Enter element 0, 1: 4 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 3 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3 Enter element 0, 1: 4 Enter element 0, 2: 12 Enter element 0, 2: 12 Enter element 1, 0: 19 Enter element 1, 1: Enter element 1, 2: 0 You entered: -3 4 12 19-80 Enter row: 1 -8 The sum of row 1 is 11. Again? (1 for yes, 2 for no): 1 Enter element 1, 0: 19 Enter element 1, 1: -8 Enter element 1, 2: 0 You entered: -3 4 12 19-8 0 The row with the largest sum is row 0. Again? (1 for yes, 2 for no): 1
Expert Answer:
Answer rating: 100% (QA)
Heres the code incorporating the required methods and menudriven interface Java import javautilScanner public class MatrixOperations public static void mainString args Scanner scanner new ScannerSyste... View the full answer
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Determine whether the following code fragment takes linear time, quadratic time, or cubic time (as a function of \(n\) ). for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) j) C[i][j] 1.0; if (i...
-
Apple River Inc.'s inventory for the month of November was as follows: Instructions (a) Calculate the ending inventory and cost of goods sold using the average cost formula in (1) A perpetual...
-
You have found the following stock quote for RJW Enterprises, Inc., in the financial pages of todays newspaper. What is the annual dividend? What was the closing price for this stock that appeared in...
-
Refer to the information in Exercise 17-7 to answer the following requirements. Required 1. Using ABC, compute the overhead cost per unit for each product line. 2. Determine the total cost per unit...
-
You have been asked by the president of your company to evaluate the proposed acquisition of a new spectrometer for the firms R&D department. The equipments basic price is $70,000, and it would cost...
-
= 12, where Let A, B M(R) and let n 1 be an integer such that Cn C = AB - BA. Prove that n is even and C4 = 12. Hint: use Problem 2.15.
-
The finance director for the City of Green Falls printed the General Fund Revenues and Appropriations Ledgers shown below for the year just ended. The beginning-of-the-year fund balance was $160,160....
-
1. Describe the product or service on which the company is focusing, which will be organic candles. 2. Write your company's mission statement based including the rationale for each component of the...
-
Financing Decisions and Firm Value What rule should a firm follow when making financing decisions? How can firms create valuable financing opportunities?
-
WACC and Taxes If I use the after-tax cost of debt for my project analysis then I should use the after-tax cost of equity as well. Do you agree with this statement? Explain.
-
Eurasian Natural Resources plc, a Kazakhstani firm listed on the London Stock Exchange, has total non-current assets of $4,938 million. Non-current liabilities are $1,038 million. Current assets,...
-
Preference shares do not offer a corporate tax shield on the dividends paid. Why do we still observe some firms issuing preference shares?
-
Explain what is meant by the cost of equity capital. How is the cost of equity capital linked to the risk of the assets of a firm? How would you use cost of equity in a capital budget analysis?
-
According to FIFO inventory flow method, which one of the following is sold first? A) B) C) D) depends on the clients cheaper inventory last purchased inventory first and last purchased are sold...
-
Name some of the various types of financial intermediaries described in the chapter and indicate the primary reason(s) each was created.
-
This problem requires the use of ACL software, which is included in the CD attached to the text. Information about installing and using ACL and solving this problem can be found in Appendix, pages...
-
Lawsuits against CPA firms continue to increase. State your opinion of the positive and negative effects of the increased litigation on CPAs and on society as a whole.
-
What major considerations should the auditor take into account in determining how extensive the review of subsequent events should be?
-
In the section of his 2007 letter to the shareholders of Berkshire Hathaway titled Fanciful FiguresHow Public Companies Juice Earnings, Warren Buffett referred to the investment return assumption...
-
Based on 2012 revenues, the six largest providers of oilfield services are: 1. Schlumberger Ltd. (NYSE: SLB) Revenues: $42.1 billion Net income: $5.5 billion 2. Halliburton (NYSE: HAL) Revenues:...
-
On 21 September 2000, Intel Corporation (NASDAQ -GS: INTC)3 issued a press release containing information about its expected revenue growth for the third quarter of 2000. The announced growth fell...
Study smarter with the SolutionInn App