5.18 LAB: Contains the character (JAVA) Write a program in java that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Add a newline to the end of the last output. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words. Ex: If the input is: 4 hello zoo sleep drizzle z then the output is: zoo,drizzle, To achieve the above, first read the list into an array. Keep in mind that the character 'a' is not equal to the character 'A'. Code Start: import java.util.Scanner; public class LabProgram { public static void main(String[] args) { /* Type your code here. */ } }
5.18 LAB: Contains the character (JAVA)
Write a program in java that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Add a newline to the end of the last output. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words.
Ex: If the input is:
4 hello zoo sleep drizzle zthen the output is:
zoo,drizzle,To achieve the above, first read the list into an array. Keep in mind that the character 'a' is not equal to the character 'A'.
Code Start:
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images