Question: Question in Java Write a program that reads a list of Strings, and a String to search for. If the input list contains the String
Question in Java

Write a program that reads a list of Strings, and a String to search for. If the input list contains the String then output true otherwise output false. The input begins with an integer indicating the number of Strings that follow. After the last String given for the input will be the String to search for. For this exercise you will need to use two Scanner methods namely next() and nextInt(). You also must define a function with the following type signature: public static boolean contains (String search For, String[] in) Ex: If the input is: 3 hello world test world the output is: true Because the input list, hello world test, contains the String world. Whereas if the input is: 3 hello world test worlds the output is: false Because "worlds' is not contained in the input list. 295062.1454608 LAB ACTIVITY 6.23.1: In Class Lab 2-10-21: Does An Array Contain A Value 0/15 LabProgram.java Load default template... 1 import java.util.Scanner; 2 3 public class LabProgram { 4 public static void main(String[] args) { 5 Scanner scanner - new Scanner(System.in); 6 7 int numInputs; 8 String[] inputs; 9 19 // your code goes here 11 12 String searchFor; 13 14 // your code goes here 15 } 16 17 // your function goes here Develop mode Submit mode When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
