Class 2 Prep Exercises

Work on these exercises in the java-exercises project, creating a new class for each. You may name the classes whatever you like, but use proper Java naming conventions.

  1. ArrayList: Write a static method to find the sum of all the even numbers in a list. Within main, create a list with at least 10 integers and call your method on the list.
  2. ArrayList and Strings: Write a static method to print out each word in a list that has exactly 5 letters.
  3. Arrays: Create and initialize an array with the following values in a single line: 1, 1, 2, 3, 5, 8. Then loop through the array and print out each value.
  4. HashMap: Make a program similar to GradebookHashMap, but which takes in students names and ID numbers (as integers) instead of names and grades. In this case, however, the keys should be integers (the IDs) and the values should be strings (the names). Modify the roster printing code accordingly.