/*
Exercise 1
When the following code is executed, how many iterations of the loop
are performed?
*/
int number = 2;
boolean done = false;
while (!done) {
number *= 2;
if (number > 64) {
done = true;
}
}
/*
Exercise 2
The following code is supposed to write out the even numbers between 1 and 15
The code has two flaws in it
a) What is the output of the code as written
b) Correct the code so that it works as intended
*/
int n = 2;
while (n != 15) {
n += 2;
System.out.print(n + " ");
}
/*
Exercise 3
What sentinel value would you choose for a program that reads telephone numbers
as integers?
*/
/*
Exercise 4
Write a nested loop code segment that produces this output
1
1 2
1 2 3
1 2 3 4
*/
}
/*
Exercise 5
Complete the method below
*/
/**
* Returns the number of times a given substring appears within the strings of a list of strings
* @param listOfStrings the ArrayList that contains the strings to check
* @param keyword the substring to find in each of the strings
* @return the number of times keyword appear in the strings listed in listOfStrings
*/
public int keywordCount(ArrayList listOfStrings, String keyword) {
}