Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java thank you! 2 files seprate! 1.Util.java 2.UtilTester.java (provided) Use the following file: UtilTester.java import java.util.ArrayList; public class UtilTester { public static void main(String[] args)
java thank you!
2 files seprate!
1.Util.java
2.UtilTester.java (provided)
Use the following file:
UtilTester.java
import java.util.ArrayList; public class UtilTester { public static void main(String[] args) { //testing min method int[] numbers = {5, 8, 4, 6, 2, 1, 7, 3}; System.out.println(Util.min(numbers)); System.out.println("Expected: 1"); int[] numbers2 = {2, 9, 4, 6, 5, 8, 7, 3}; System.out.println(Util.min(numbers2)); System.out.println("Expected: 2"); int[] numbers3 = {10, 9, 4, 6, 5, 8, 7, 3}; System.out.println(Util.min(numbers3)); System.out.println("Expected: 3"); //testing first contains String[] javaIdentifiers = {"Integer", "Double", "Float", "Char", "boolean", "long", "short", "byte"}; System.out.println(Util.contains(javaIdentifiers,"c")); System.out.println("Expected: true"); System.out.println(Util.contains(javaIdentifiers, "x")); System.out.println("Expected: false"); System.out.println(Util.contains(javaIdentifiers,"B")); System.out.println("Expected: true"); //testing second contains ArrayListwords = new ArrayList (); System.out.println(Util.contains(words, 'b')); System.out.println("Expected: []"); words.add("Big"); words.add("Java"); words.add("is"); words.add("best"); words.add("Be"); words.add("the"); words.add("computer"); words.add("CS46A/B"); System.out.println(Util.contains(words, 'e')); System.out.println("Expected: [best, Be, the, computer]"); System.out.println(Util.contains(words, 'B')); System.out.println("Expected: [Big, best, Be, CS46A/B]"); System.out.println(Util.contains(words, 'a')); System.out.println("Expected: [Java, CS46A/B]"); System.out.println(Util.contains(words, 'k')); System.out.println("Expected: []"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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