Write method headers (declarations) for methods with the foloowing descriptions:
ID: 3555329 • Letter: W
Question
Write method headers (declarations) for methods with the foloowing descriptions:(Note: the method should not return anything if not necessary.)
1. A method that returns the sum of its two input parameters,which are doubles.
2. A method that takes a string as a parameter and returns the same string, with a period appended.
3 A method that prints out the time of day to the console.
4. A method that takes an array of strings as a parameter and appends a period to each string.
5. A method that takes an array of strings as one parameter appends the contents of a second parameter (a string) to each string.
6. A method that returns true if its interger parameter is even, false otherwise.
7. A method that returns the integer that is closest to its double parameter, without being grater.
8. A method that takes two one-dimensional arrays of int's as input and returns a two dimensional array that is the concatenation of the two input arrays.
9. A method that returns the number of columns in a two-dimensional array of doubles
10. A method that takes an array of int's as one parameter adds the value of a second parameter (an int) to each item in the array.
11. A method that takes a two-dimensional array of int's as a parameter and searches the array for the second parameter, returning true if the second parameter matches any of the integers in the array, and false otherwise.
Explanation / Answer
Method headers
1.
public double sumTwo(double x, double y)
2.
public String periodAppend(String x)
3.
public static void printTime()
4.
public static void addArrayPeriod(String arr[])
5.
public static void addArrayString(String arr[], String str)
6.
public static boolean evenOdd(int x)
7.
public static int integerNearest(double x)
8.
public static int[][] oneTwo(int a[], int b[])
9.
public static int numCols(double arr[][])
10.
public static void addInt(int arr[], int x)
11.
public static boolean search(int arr[][], int x)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.