1. Write a Java program to implement the following methods: a. getArray(): Input a two dimensional...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write a Java program to implement the following methods: a. getArray(): Input a two dimensional array of size 3x3, and return it to main(). b. Sum(): Take the array as an argument, calculate sum of elements of the array and return the value of sum. c. Print sum of the elements in main() 2. Write statements to do the following: a. Create an array to hold 12 double values. b. Assign the value 7.2 to the last element in the array. c. Display the sum of the first two elements. d. Write a loop that computes the sum of all elements in the array. e. Write a loop that finds the maximum element in the array. 3. Complete the missing statements in the following code segments: The toArrayOfChar method takes a string n as a parameter and returns an array of characters. Example: When to ArrayOfChar("COMP213") is called, it will return the following array: 'C' '0' 'M' 'P' '2' public static { } [] a = new for(int i=0; i< { a[i]= n. return a; '1' '3' toArrayOfChar(String n) b. Access the element at index 0. c. Access the last element. d. Access the element at index 4. _[7]; (++1 4. Write a program that reads two 2-by-2 matrix and display sum of the two matrices. That is The matrix a[][] and b[][] are initialized with values, the sum of matrix a[][] and b[][] is stored in matrix c[][]. 5. Given the following array definition, double[] arr = new double[5]; Write code to answer the following questions: a. Access the 1st element. 6. Write a Java program to create an Array of marks and add the elements 16.3, 12.7, 13.5, 20.0 to the list. Display the values in the list using for loop. 1. Write a Java program to implement the following methods: a. getArray(): Input a two dimensional array of size 3x3, and return it to main(). b. Sum(): Take the array as an argument, calculate sum of elements of the array and return the value of sum. c. Print sum of the elements in main() 2. Write statements to do the following: a. Create an array to hold 12 double values. b. Assign the value 7.2 to the last element in the array. c. Display the sum of the first two elements. d. Write a loop that computes the sum of all elements in the array. e. Write a loop that finds the maximum element in the array. 3. Complete the missing statements in the following code segments: The toArrayOfChar method takes a string n as a parameter and returns an array of characters. Example: When to ArrayOfChar("COMP213") is called, it will return the following array: 'C' '0' 'M' 'P' '2' public static { } [] a = new for(int i=0; i< { a[i]= n. return a; '1' '3' toArrayOfChar(String n) b. Access the element at index 0. c. Access the last element. d. Access the element at index 4. _[7]; (++1 4. Write a program that reads two 2-by-2 matrix and display sum of the two matrices. That is The matrix a[][] and b[][] are initialized with values, the sum of matrix a[][] and b[][] is stored in matrix c[][]. 5. Given the following array definition, double[] arr = new double[5]; Write code to answer the following questions: a. Access the 1st element. 6. Write a Java program to create an Array of marks and add the elements 16.3, 12.7, 13.5, 20.0 to the list. Display the values in the list using for loop.
Expert Answer:
Answer rating: 100% (QA)
Sure lets tackle these programming tasks stepbystep 1 Write a Java program to implement the following methods a getArray Input a twodimensional array ... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
1. (10 points) At formation, the balance sheet of ABCD general partnership is as follows: Partner A Profit/Loss Asset Adjusted FMV % basis 25 Land (1) 30000 90000 Note 10000 10000 receivable B 25...
-
Why take the time for team members to learn about each others personal lives? What are the responsibilities of the team leader, and what are the most desirable skills and behaviors? What is the value...
-
Find the currents flowing in the circuit in the figure below. Use the direction of the currents as shown in the figure. Explicitly show how you follow the steps in the Problem-Solving Strategies for...
-
If a particular glucose fermentation process is 87.0% efficient, how many grams of glucose would be required for the production of 51.0 g of ethyl alcohol (C 2 H 5 OH)? C 6 H 12 O 6 2C 2 H 5 OH +...
-
Rocky owns and operates Balboa's Gym located in Philadelphia. The following transactions occur for the month of October: October 2 Receive membership dues for the month of October totaling $7,500....
-
Conduct a detailed Environmental Scan of the company using 3 different frameworks including traditional and digital. You should refer to your offline/digital marketing audit wherever necessary in the...
-
Assume that Fossil sold watches to a department store on account for \($43,000\). How would this transaction affect Fossils accounting equation? a. Increase both liabilities and stockholders equity...
-
An investor sells a stock short for $36 a share. A year later, the investor covers the position at $30 a share. If the margin requirement is 60 percent, what is the percentage return earned on the...
-
A machine of mass 520 kg produces a vertical disturbing force which oscillates sinusoidally at a frequency of 25 Hz. The force transmitted to the floor is to have an amplitude, at this frequency, not...
-
Lunatics, an e-commerce sports company wants to buy Rowdy Trading Cards at a cost of $504 million. Rowdy will operate for 20 years. They expect annual cash flows from operations to be $70.1 million...
-
Solve each inequality, graph the solution on the number line, and write the solution in interval notation. a) i. Solve the inequality - 5y 2 85 ii. Graph the solution on the number line. + 20 + -19...
-
Bozo Company has total costs of $100,000 when it sells 20,000 units. If total fixed costs are $40,000, what is variable cost per unit?
-
Here my is papr i have gathered information help expand more the questions to papr 5 pg. Our coffee shop chain expansion plan is comprehensively designed to enhance productivity, improve competitive...
-
Nooks Company is planning to issue $510,000 of 5%, ten-year bonds payable to borrow for a major expansion. The owner, Richie Nooks, asks your advice on some related matters. Read the requirements....
-
Explain Dantzig's discovery that all feasible regions are convex (bulge outward) polygons (many-sided figures) and that the optimal solution must lie at one of the corner points. The note should have...
-
Your company is looking at a new project in Mexico. The projectwill cost 1,000,000 pesos. The cash flows are expected to be350,000 pesos per year for 5 years. The current spot exchange rateis 19.07...
-
Q.17 The inverse of matrix be a zero matrix. Then O B- A B where [4] is any matrix and [B][C] are non singular and [0] [co] O C O -B-BAC- C- B-BAC None of these
-
The following exercises are not grouped by type. Solve each equation. x610x -9
-
a. Show the result of inserting 3, 1, 4, 6, 9, 2, 5, 7 into an initially empty binary search tree. b. Show the result of deleting the root.
-
a. Give an algorithm to find the minimum number of edges that need to be removed from an undirected graph so that the resulting graph is acyclic. b. Show that this problem is NP-complete for directed...
-
a. Give a precise expression for the minimum number of nodes in an AVL tree of height h. b. What is the minimum number of nodes in an AVL tree of height 15?
-
What is the effect of pressure on equilibrium conversion of a gas-phase chemical reaction?
-
The diathermal wall (a) Is incapable of exchanging heat with the surroundings (b) Permits the full flow of heat from the system to the surroundings and vice versa (c) Both (a) and (b) (d) None of...
-
The total energy of a system comprises (a) Kinetic energy, potential energy and vibrational energy (b) Kinetic energy, potential energy and rotational energy (c) Kinetic energy, potential energy and...
Study smarter with the SolutionInn App