In JAVA:
Write the definition/implementation of a method named MyMethod that takes 2 strings and return the total length of the 2 strings. For example, if the method is called with strings “hello” and “there”, the method returns 10.
Show how you would call this method (I don't need the full program, just a proper statement to call the method).
public class MyMethodTest {
public static int MyMethod(String s1, String s2) {
return s1.length() + s2.length();
}
public static void main(String[] args) {
System.out.println(MyMethod("hello", "there")); // statement to call the method
}
}

In JAVA: Write the definition/implementation of a method named MyMethod that takes 2 strings and return...
Write a method named avgLength which takes an array of Strings as an input parameter and returns a double. The method should calculate and return the average length of all the strings in the array (in java langauge)
Question 1[JAVA] Add a method in the Main class named getLines() that takes a filename as a String and returns each line in the file in an array. Have each element of the array be a String. Do not include the newline at the end of each line. Use a BufferedReader object to read the file contents. Note, the contents of input.txt will be different (including the number of lines) for each test case. Example: getLines( "input.txt" ) returns (an...
java coding question: Write a complete program that contains a method named repeat that takes a String as a parameter and returns nothing The method will print (use System.out.println) the input string 5 times. The main method will call the method repeat with the value "Java".
(intro to java help?) Write a method manyStrings that takes an ArrayList of Strings and an integer n as parameters and that replaces every String in the original list with n of that String. For example, suppose that an ArrayList called "list" contains the following values: ("squid", "octopus") And you make the following call: manyStrings(list, 2); Then list should store the following values after the call: ("squid", "squid", "octopus", "octopus") As another example, suppose that list contains the following: ("a",...
Java Program Write a recursive method that takes a string and return a string where every character appears twice. Output must match exactly as below: only two LL's since there is already two of the character For example, if the string is “HELLO”, it will return “HHEELLOO”. Write a program to test it. must be recursive!!!
in java Write a class named Palindrome.java and Write a method isPalindrome that takes an IntQueue as a parameter and that returns whether or not the numbers in the queue represent a palindrome (true if they do, false otherwise). A sequence of numbers is considered a palindrome if it is the same in reverse order. For example, suppose a Queue called q stores this sequence of values: front [3, 8, 17, 9, 17, 8, 3] back Then the following call:...
Write a public static method named getMaxOf2Ints that takes in 2 int arguments and returns the Maximum of the 2 values Write a public static method named getMinOf2Ints that takes in 2 int arguments and returns the Minimum of the 2 values Write apublic static method named getMaxOf3Ints that takes in 3 int arguments and returns the Maximum of the 3 values Write a public static method named getMedianOf3Ints that takes in 3 int arguments and returns the Median Value...
Problem 16)(Java) Write a complete definition for a public static method called closeEnough that takes a double and an integer and returns true if the double is within one unit of the integer. For example closeEnough(3.9, 5) -> false closeEnough(4.1, 5) -> true closeEnough(6.0, 5) -> true
Must be C++ Write the declaration (not the full implementation!) of a class named Panda which inherits from a class named Bear and includes the following: A string property called Name An int property called Gender A float property called Weight Public pointers to both a mother and father Panda object A private vector of objects of type GeneticMarker (assume the GeneticMarker type is already defined elsewhere) A public method called AddMarker which takes a GeneticMarker and returns an int...
JAVA 1.Write a static method named getMaxEven(numbers) which takes an array of positive integers as a parameter. This method calculates and returns the largest even number in the list. If there are no even numbers in the array, the method should return 0. You can assume that the array is not empty. For example: Test Result int[] values = {1, 4, 5, 9}; System.out.println(getMaxEven(values)); 4 System.out.println(getMaxEven(new int[]{1, 3, 5, 9})); 0 public static int --------------------------------------------------------------------------------- 2. Write a static method...