We have looked at the summary posted yesterday:

http://silo.cs.indiana.edu:8346/c212/fall2015/1108a.phps

They mimic what announced earlier:

http://www.cs.indiana.edu/classes/c212-dgerman/fall2015/lectureFourteen.html

Let's exemplify the requirements for every problem on the exam. 

Please be minimal in your implementation/answers on the exam. 

Example: 7. Simplest program that notices, process, responds to keyboard events. 

import javax.swing.JFrame;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;

public class Seven extends JFrame implements KeyListener {
  public static void main(String[] args) {
    Seven seven = new Seven();
    seven.setVisible(true); 
    seven.setSize(400, 400); 
    seven.addKeyListener(seven); 
  }
  public void keyPressed(KeyEvent e) { }
  public void keyReleased(KeyEvent e) { }
  public void keyTyped(KeyEvent e) { 
    System.out.println("Howdy " + e); 
  }
}

In the past JFrame would only send keyPressed or keyReleased events on
account that you can't type in a JFrame because there's no place to store
what you type (as in a JTextField).

Semester Project 

Stage One: place the circles at the top

Stage Two: shoot circles and they stick

Stage Three: circles disappear according to color of neighbors

Due dates:

  Stage One: (almost Eight from the exam problems) Mon Nov 16

  Stage Two: Mon Nov 30 (or Wed Dec 02)

  Stage Three: Wed Dec 12 (printed with prose and bring to the final)

  The Final is based on the project:

  (a) add and keep score

  (b) add an end of the world predicate 

  (c) add your name and score to a file of top ten scores (sort)

  (d) allow circles to persist separated from the ceiling

For the final you bring a pencil we give you paper and you can rely on the
report you brought. Then you submit both: stage three of the project and your
final exam. (Hopefully the code of the stage three is in OnCourse by the time 
you come to take the final with your report). 

http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html

Here's Exercise Five: 

import java.util.ArrayList; 
import java.util.Collections; 

public class Student {
  String name;
  int age; // not private so I can simplify a little the comparisons 
  public Student(String name, int age) {
    this.name = name;
    this.age = age;
  }
  public String toString() {
    return "Student(" + this.name + ", " + this.age + ")";  
  }
  public static void main(String[] args) {
    ArrayList<Student> students = new ArrayList<Student>();  
    students.add( new Student("Laura" , 12) ); 
    students.add( new Student("Larry" , 13) ); 
    students.add( new Student("Leslie", 11) ); 
    students.add( new Student("Les", 11) ); 
    System.out.println( students );
    Collections.sort( students, new Ascending() );    
    System.out.println( students );
    Collections.sort( students, new Descending() );    
    System.out.println( students );
    
  }
}

import java.util.Comparator;

public class Ascending implements Comparator<Student> {
  public int compare(Student a, Student b) {
    if (a.age < b.age) return -1; 
    else if (a.age > b.age) return 1;
    else return a.name.compareTo(b.name); 
  }
}

import java.util.Comparator;

public class Descending implements Comparator<Student> {
  public int compare(Student a, Student b) {
    if (a.age < b.age) return 1; 
    else if (a.age > b.age) return -1;
    else return (-1) * a.name.compareTo(b.name); 
  }
}

See you next time for the employer panel. 

I will post all the questions and my preferred answers as a Study Guide today. 

--