Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Method: fillArray the method accepts a non-null String variable as an argument. Return a char array that has been filled from the String passed to

Method: fillArray

the method accepts a non-null String variable as an argument. Return a char array that has been filled from the String passed to the method, each element set to the corresponding character in the string. public char[] fillArray(String var)

Method: stringArray

the method accepts an array of chars as an argument if the chArray is null or length is zero, returns an empty string if chArray is not null, return a single string with each of the characters in the array in the string. public String stringArray(Char[] chArray)

Method: productMatrix 0

Method: sumOfSquares the method accepts an array of ints if the array is null or of size zero, return 0 if the size of the array is greater than or equal to 1 return an int equal to the sum of the square of each element of the array public long sumOfSquares(int[] intArray)

Method: incPosArray the method accepts an array of ints if the array is null or of size zero, simply return if the size of the array is greater than or equal to 1 increment each positive element of the array, leaving the negative elements and the elements equal to zero set to their incoming values public void incPosArray(int[] intArray)

public Q3{

/* * Method: fillArray */ public char[] fillArray(String var){ System.out.println( "fillArray not implemented"); return null; } /* * Method: stringArray */ public String stringArray(char[] chArray) { System.out.println( "stringArray not implemented"); return null; } /* * Method: productMatrix */ public int[][] productMatrix(int n){ System.out.println( "productMatrix not implemented"); return null; } /* * Method: sumOfSquares */ public long sumOfSquares (int[] intArray) { System.out.println( "sumOfSquares not implemented"); return -1; } /* * Method: incPosArray */ public void incPosArray (int[] intArray) { System.out.println( "incPosArray not implemented"); return; } public static void main (String[] args) { Q3 q3 = new Q3(); //Put your test code here } 

}

how do you construct these methods? image text in transcribed

PUbLJL * Method: fillArray * Precondition: the method accepts a non-null String variable as an argument the string passed to the method, each element set to the corresponding character in the string Postcondition: Return a char array that has been filled from (i.e. resultt0]-the character at index 0 in the string) public char[) fillArray(String var); Precondition: the method accepts an array of chars as an argument Postcondition: if chArray is not null, return a single string *Method: stringArray * Postcondition: if chArray is nul1 or length is zero, returns an empty string with each of the characters in the array in the string. ' ! ' ) * Example: The array {'N', 'e', 'I', '1', ' "returns the string "Well done! " , , 'd', 'o', 'n, , ,e', public String stringarray (char [] charray) * Method: productMatrix * precondition : 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

3. How can we confi rm both ourselves and others?

Answered: 1 week ago

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago

Question

=+ a. a family deciding whether to buy a new car

Answered: 1 week ago