Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a Java program to implement the following methods: a. getArray(): Input a two dimensional array of size 3x3, and return it to
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.
Step by Step Solution
★★★★★
3.46 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Sure lets tackle these programming tasks stepbystep 1 Write a Java program to implement the following methods a getArray Input a twodimensional array ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started