[Solved]Class Functions2 Demonstrate Ability Code Specific Requirements Exercise Involves Implemen Q37248123
/** Class Functions2 is to demonstrate the ability to code to specific requirements. <br> <br> This exercise involves implementing several methods. Stubs for each method with documentation are given here. It is your task to fill out the code in each method body so that it runs correctly according to the documentation. <br> <br> You should create a main method to run and test your methods. Example inputs with output are provided in the comments before each method. At a minimum, your solutions must pass these tests. //import NOTICE: Imports are not allowed for this assignments!*/public class Functions2{ /** Verrifys if an integer is present in an array. <br> Given an int and an array of ints, return true if the array contains the int, false otherwise. <br> hasInt(7, {1, 7, 3}) -> true <br> hasInt(3, {1, 2, 4, 5}) -> false <br> hasInt(4, {5, 3, 6, 1, 4}) -> true <br> @param number int number, @param numbers int[] array of numbers @return true if contained, false if not */ public static boolean hasInt(int number, int[] numbers) { //your code here return false; }//end hasInt /** Given a String and an array of Strings, return true if the array contains the String, false otherwise. <br> Note: Capital letters count. <br> <br> hasString(“fizz”, {“fizz”, “buzz”, “bang”, “boom”}) -> true <br> hasString(“Fizz”, {“fizz”, “buzz”, “bang”, “boom”}) -> false <br> hasString(“fizz”, {“buzz”, “bang”, “boom”}) -> false <br> hasString(“buzz”, {“1”, “2”, “$$#%^”, “pico”}) -> false <br> hasString(“4”, {“5”, “3”, “6”, “1”, “4”}) -> true <br> @param paramString a String @param strings String[] an array of Strings @return true if contained, false if not **/ public static boolean hasString(String paramString, String[] strings) { //your code here return false; }//end hasString /** Given an an array of ints, return the largest int in the array. <br> <br> maxInt({1, 7, 3}) -> 7 <br> maxInt({1, 2, 4, 5}) -> 5 <br> maxInt({5, 3, 6, 1, 4}) -> 6 <br> @param numbers int[] array of numbers @return int, the largest integer in the array. **/ public static int maxInt(int[] numbers) { //your code here return 0; }//end maxInt /** Given an array of Strings, return the first String in alphabetical order. <br> Note: Capital letters count <br> <br> firstString({“fizz”, “buzz”, “bang”, “boom”}) -> “bang” <br> firstString({“Fizz”, “buzz”, “bang”, “boom”}) -> “Fizz” <br> firstString({“1”, “2”, “$$#%^”, “pico”}) -> “$$#%^” <br> firstString({“5”, “3”, “6”, “1”, “4”}) -> “1” <br> @param strings String[] array of Strings. @return String, alphabetically the first in the array. **/ public static String firstString(String[] strings) { //your code here return “”; }//end firstString /** Given an array of Strings, return an array with the length of the longest string. <br> <br> longestString({“a”, “big”, “fat”, “cat”}) -> 3 <br> longestString({“Fizz”, “buzz”, “bang”, “boom”}) -> 4 <br> longestString({“1”, “2”, “$$#%^”, “pico”}) -> 5 <br> longestString({“5”, “3”, “6”, “1”, “4”}) -> 1 <br> longestString(“These”, “Are”, “the”, “Good”, “Old”, “days”) -> 5 <br> @param strings String[] array of Strings. @return int, the length of the longest string in the array. **/ public static int longestString(String[] strings) { //your code here return 0; }//end longestString /** Given an int and an array of ints, return -1 if the array does not contain the int. Otherwise return the position of the int in the array. <br> <br> placeInt(7, {7, 3}) -> 0 <br> placeInt(7, {2, 7, 3}) -> 1 <br> placeInt(3, {1, 2, 4, 5}) -> -1 <br> placeInt(4, {5, 3, 6, 1, 4}) -> 4 <br> @param number int an integer. @param numbers int[] array of integers. @return int The position of the integer in the array, -1 if not contained. **/ public static int placeInt(int number, int[] numbers) { //your code here return 0; }//end placeInt /** Given a String and an array of Strings, return -1 if the array does not contain the String. Otherwise return the position of the String in the arary. <br> <br> placeString(“fizz”, {“fizz”, “buzz”, “bang”, “boom”}) -> 0 <br> placeString(“buzz”, {“fizz”, “buzz”, “bang”, “boom”}) -> 1 <br> placeString(“bang”, {“fizz”, “buzz”, “bang”, “boom”}) -> 2 <br> placeString(“boom”, {“fizz”, “buzz”, “bang”, “boom”}) -> 3 <br> placeString(“Fizz”, {“fizz”, “buzz”, “bang”, “boom”}) -> -1 <br> placeString(“fizz”, {“buzz”, “bang”, “boom”}) -> -1 <br> placeString(“buzz”, {“1”, “2”, “$$#%^”, “pico”}) -> -1 <br> placeString(“4”, {“5”, “3”, “6”, “1”, “4”}) -> 4 <br> @param paramString String a String. @param strings String[] an array of Strings. @return int The position of the String in the array, -1 if not contained. **/ public static int placeString(String paramString, String[] strings) { //your code here return 0; }//end placeString}//end Functions2
Expert Answer
Answer to /** Class Functions2 is to demonstrate the ability to code to specific requirements. This exercise involves implementin… . . .
OR

