28 Feb 2012 [ 201 week8 ]
1. Define a method that takes an array of Strings and and a char c as input, and returns the longest element of the array that starts with the input c. If there is no such element, return an empty string.

2. Define a method that takes two ArrayLists and returns an ArrayList containing the greatest element in each position. For example, with inputs {1, 5, 8} and {3, 2, 11}, the output should be {3, 5, 11}. You can assume the inputs will have the same number of elements.

3. Add an instance method called update(int x) to the following class so that when update is called, the object always has the two largest values seen so far contained in first and second.

public class Big2 {
private int first;
private int second;

public Big2(int first, int second) {
this.first = Math.max(first, second);
this.second = Math.min(first, second);
}
}

4. Write a program that prints all the multiples of 3 or 5 in the range from 1 to 100.

5. Write a program that reads input until the user types a 0, and then prints the product of all values entered.

6. Define a class that keeps track of a student and a list of homework grades. Include a method to add a new grade, a method to return the average of all grades, and a method to return a letter grade (using A for at least 90%, B for at least 80%, etc.). Assume all homeworks are graded out of 100.