CS 141 Fall 2012 -- Final review
The final will cover all the material from the entire course. So, the first thing to review is the two previous review pages
the are: here, and here.
Plus, there's the new material since the second midterm. It includes:
- File I/O
- Creating as a FooList
- Adding Foos
- Iterating over a FooList
- to display
- to find/return a Foo with particular value in some field
- Sorting an ArrayList
- Using a Comparable
- Using a Comparator
Sample questions (in addition to those in the two previous review sheets!)
An exam from 2007
- Write a complete Song class, with variables for the title and the length (in seconds). Include
accessors for both variables,
Song(MyReader). Assume the format of the input file
and length on separate lines.
- Write a complete SongList class which extends ArrayList<Song> and has an input method to read from a file and a
public String toString() method that returns each song's info on a separate line.
- Write a
find(String, SongList) method which is passed a song title to find and a SongList and returns the Song with that title,
or null if that title is not found
- Write a method
SongList longerThan(SongList, int), which is passed a SongList and an int, and returns another SongList containing all
the songs in the parameter list which are longer than the int parameter.
- Write a method that souts all the titles of the Songs in a SongList parameter, one per line
An exam from 2010