34 lines
622 B
Java
34 lines
622 B
Java
|
/* Joseph Green
|
||
|
* 7-Oct-2020
|
||
|
*
|
||
|
* take int for number of words
|
||
|
* take list of words
|
||
|
* take a char
|
||
|
*
|
||
|
* print out every word in the list that contains the char at least once
|
||
|
* Assume at least one word will contain the given char
|
||
|
* words will be < 20
|
||
|
*/
|
||
|
|
||
|
import java.util.Scanner;
|
||
|
|
||
|
public class LabProgram {
|
||
|
public static void main(String[] args) {
|
||
|
/* Type your code here. */
|
||
|
String[] words = {"jack", "jill", "james"};
|
||
|
|
||
|
for (String word : words){
|
||
|
System.out.println(word.length());
|
||
|
}
|
||
|
|
||
|
String newWord = "jack";
|
||
|
|
||
|
for (char ch : newWord){
|
||
|
System.out.println(ch);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|