1) Write a Java Program for the following steps(one-by-one) (15 Points): a) The program asks the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1) Write a Java Program for the following steps(one-by-one) (15 Points): a) The program asks the user to provide the number of rows and columns. (2 Points) b) The program should create a 2D array based on the user given size. (2 Points) c) The program should store random values in range from 55 to 550 within the 2D array and print it. (2 Points) d) The program should then call a method called "findAverage" and pass this 2D array as a parameter to this method. (2 Points) e) Inside the method "findAverage", the program should ask the user to enter a row number of his/her choice. (i.e., if there are 4 rows, then the user should provide a number in range of 0 to 3). (2 Points) f) The method should print the average of values present only in the user given row number. (4 points) g) Inside the main method, the program should call another method called "getArray" and pass the 2D array (from step (c)) as its parameter. (2 Points) h) Inside the "getArray" method, the program should multiply only the odd values present within the 2D array by 2. (5 Points) i) The program should then return the resulting 2D array back to the main method. (2 Points) j) The main method should print the returned 2D array. (2 Points) CPS 2231 Computer Programming Homework Assignment 2 2) Write a Java Program for the following steps(one-by-one) (15 Points): Write a Java program that prompts the user to enter the dimensions (number of rows and columns) of a 2D array, creates the array, and populates it with random integer values in the range of 100 to 500. Then, your program should sort the values in each column of the matrix in ascending order and print the sorted matrix. 1) Write a Java Program for the following steps(one-by-one) (15 Points): a) The program asks the user to provide the number of rows and columns. (2 Points) b) The program should create a 2D array based on the user given size. (2 Points) c) The program should store random values in range from 55 to 550 within the 2D array and print it. (2 Points) d) The program should then call a method called "findAverage" and pass this 2D array as a parameter to this method. (2 Points) e) Inside the method "findAverage", the program should ask the user to enter a row number of his/her choice. (i.e., if there are 4 rows, then the user should provide a number in range of 0 to 3). (2 Points) f) The method should print the average of values present only in the user given row number. (4 points) g) Inside the main method, the program should call another method called "getArray" and pass the 2D array (from step (c)) as its parameter. (2 Points) h) Inside the "getArray" method, the program should multiply only the odd values present within the 2D array by 2. (5 Points) i) The program should then return the resulting 2D array back to the main method. (2 Points) j) The main method should print the returned 2D array. (2 Points) CPS 2231 Computer Programming Homework Assignment 2 2) Write a Java Program for the following steps(one-by-one) (15 Points): Write a Java program that prompts the user to enter the dimensions (number of rows and columns) of a 2D array, creates the array, and populates it with random integer values in the range of 100 to 500. Then, your program should sort the values in each column of the matrix in ascending order and print the sorted matrix.
Expert Answer:
Answer rating: 100% (QA)
Alright lets tackle the first set of tasks for the Java program java import javautilScanner import j... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Gale Company has the following inventory and purchases during the fiscal year ended December 31, 2023. Beginning Inventory Feb. 10 purchased Feb. 20 sold Mar. 13 purchased Sept. 5 Oct. 10 purchased...
-
Cash Investment in equity securities Accounts receivable Inventory Prepaid insurance (for the next 9 months) Land Buildings Accumulated depreciation-buildings Equipment Accumulated...
-
Connect Four is a turn-based game normally played with anupright 6 x 7 (height x width) rectangular grid cage in which checkers are dropped through holesin the top. Playing: Each player is...
-
Young tableaux. Suppose you have an \(n\)-by- \(n\) array of integers a [] [] such that, for all \(i\) and \(j, a[i][j] A two-dimensional array with this property is known as a Young tableaux. Write...
-
Consider two long, parallel, and oppositely charged wires of radius d with their centers separated by a distance D. Assuming the charge is distributed uniformly on the surface of each wire, show that...
-
Air at room temperature and atmospheric pressure has a mass density of 1.2 kg/m3. The average molecular mass of air is 29.0 u. How many molecules are in 1.0 cm3 of air?
-
Design a process for the separation of \(1,000 \mathrm{kgmol} / \mathrm{hr}\) of a mixture composed of \(50 \mathrm{~mol} \%\) acetone (A) and \(50 \mathrm{~mol} \%\) heptane (C) to highly pure...
-
Will Company assembles products from a group of interconnecting parts. The company produces some of the parts and buys some from outside vendors. The vendor for Part X has just increased its price by...
-
Analyze the Navier-Stokes equations in the context of fluid dynamics, focusing on their mathematical complexity and physical interpretation, and discuss the conditions under which these equations...
-
Refer to Exercise 29 of Section 4.2. For what values of h will a sensitivity analysis on the effect of a change of h pounds of peat be valid? In exercise A lawn and garden store creates three...
-
Cathy opens a savings account with a deposit of $7,000. She deposits $3,000 a year later, $4,000 a year after that, and $1,000 at the end of the third year. The account grows by an annual effective...
-
Pisces Ecclesiastical Ministries (the "Church") is a 45-member congregation operating out of a remote location in California'sSierra Nevada mountainrange. The Church considers fish sacred, and...
-
A transfer price is Blank______. Multiple choice question. the amount charged when one division sells to another division the average of competitors' selling prices an external price set to sell...
-
Justify why forecasting methodssuch as Market research, Time-series forecasting, Multiple linear regression and Scenario planning are useful in the Traditional market and the Multi-sided platform...
-
Calculate the net welfare gain/loss for an insurance policy assuming the following amounts. Risk premium => $100 Expected benefits => $840 Moral hazard losses => $80 Insurance premium => $924 2)...
-
Kenworth Company uses a job-order costing system. Only three jobs-Job 105, Job 106, and Job 107-were worked on during November and December. Job 105 was completed on December 10; the other two jobs...
-
Write an essay about the overall picture of delinquency in the United States. The purpose of this essay is to provide more in-depth insight into the official and unofficial means of measuring the...
-
Respond to the ethical judgments required based on the following scenarios. Scenario 1. Assume you have collected a sample using MUS and that you have evaluated that sample to calculate a total...
-
Write a program that computes the following summation series using the Rational class: You will discover that the output is incorrect because of integer overflow (too large). To fix this problem, see...
-
The international standard letter/number mapping found on the telephone is shown below: Write a program that prompts the user to enter a letter and displays its corresponding number. 2 abc 3 def 5 ik...
-
Modify GraphView in Listing 28.6 to add a new data field tree with a set method. The edges in the tree are displayed in red. Write a program that displays the graph in Figure 28.1 and the DFS/BFS...
-
Explain the term Energy. Discuss its various forms.
-
Explain cyclic and quasi static process.
-
Explain the terms : state, phase, process and cyclic process.
Study smarter with the SolutionInn App