Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab3.java X 1 package code; 3 import java.util.ArrayList; s public class Lab3 t 7 /* 75 COMPETENCY POINTS *Question 1: Define this method so it
"Lab3.java X 1 package code; 3 import java.util.ArrayList; s public class Lab3 t 7 /* 75 COMPETENCY POINTS *Question 1: Define this method so it returns those strings from the ArrayList named list that do not contain the String named s. There are (at least) two ways to do this 1) use the contains(String) -boolean method 12 13 Ex. "Bookkeeper".contains( keep") returns true Ex "Bookkeeper".containsC idgfai returns false 2) use the indexOf(String)- int method *Ex Bookkeeper".indexOfC"keep") returns 4 15 18 19 Ex "Bookkeeper". indexOfC"idgfaj) returns -1 Example 1: If list is C"Leela" "Fry","Zoidberg", "Bender"] and s is "er. then the answer is C"Lsela","Fry Example 2: If list is C"Leela" "Fry","Zoidberg", "Bender"] and s is "e then the answer is ["Fry"] 25 Example 3: If list is C"Leela" "Fry","Zoidberg", "Bender"] and s is "XXZ then the answer is C"Lsela","Fry", "Zoidbera""Bender" 30 31 public ArrayList answer-new ArraylistO return answer; I edit this method to return the correct value in answerl 35 36 75 COMPETENCY POINTS Question 2: 38 *Return the lowest index for a String that has lengthlimit Return -1 if all the strings have length limit
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