Minute paper for today: 

1. Is the new grading system working reasonably well for you?

2. Name or describe one missing or annoying feature of the system.

3. Shold we keep it and improve it?

4. Should we go back to OnCourse and grade programs by hand (like essays).

In addition please write your name for attendance purposes.

Early Evaluation Exam: read Java

Pick them up from Adrian

http://silo.cs.indiana.edu:8346/cgi-bin/spr2014/schedule

We can talk about makeups and grades. 

Midterm Exam: write Java

Study Guide will contain a list of 12-16 problems from the book. 

On the exam you will get 2 problems, at random.

The exam has two parts: 

(a) on Wed in class paper closed-book 

(b) you will get the exam ungraded back in lab

You will type the programs in and test debug them.

Final exam is departmental in a lab, on computer. 


  int[] a; 

  a = new int[20]; 

  int b[]; 

  b = new int[12];

  int[] c = { 1, 2, 3, 4}; 

  int[] d = { 5, -1};
 
  int[] e = {10, 8, 7}; 

  int[][] n; 

  int[] m[];

  int q[][];
 
  n = new int[3][4]; 

Given c, d and e can you collect them in an array? 

  int x,  y, z; 

  x = 3;

  y = -2; 
  
  z = 10; 

  int[] u[] = new int[3][]; // or is it new int[][3];  

  u[0] = c; 

  u[1] = d;

  u[2] = e; 

Welcome to DrJava.  Working directory is C:\Users\dgerman
> int[][] a = new int[3][4];
> a
{ { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }
> int[] c = {1, 2, 3, 4}
> c
{ 1, 2, 3, 4 }
> a
{ { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }
> a[0] = c;
> a
{ { 1, 2, 3, 4 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }
> int[] d = {-1, 4};
> d
{ -1, 4 }
> a[1] = d;
> a
{ { 1, 2, 3, 4 }, { -1, 4 }, { 0, 0, 0, 0 } }
> int[] e = { -3,-2,-1};
> e
{ -3, -2, -1 }
> a[2] = e
{ -3, -2, -1 }
> a
{ { 1, 2, 3, 4 }, { -1, 4 }, { -3, -2, -1 } }
> a[2][1]
-2
> a[2][0]
-3
> for (int[] row : a) {
    for (int elem : row)
      System.out.printf("%3d ", elem);
    System.out.println();
  }
  1   2   3   4 
 -1   4 
 -3  -2  -1 
> a
{ { 1, 2, 3, 4 }, { -1, 4 }, { -3, -2, -1 } }
> a.length
3
> a[1].length
2
> import java.util.Arrays; for (int row = 0; row < a.length; row = row + 1) 
    System.out.println( Arrays.toString( a[row] ) );
[1, 2, 3, 4]
[-1, 4]
[-3, -2, -1]
> for (int row = 0; row < a.length; row = row + 1) {
    for (int column = 0 column < a[row].length; column = column + 1) {    

Invalid variable declaration
> for (int row = 0; row < a.length; row = row + 1) {
    for (int column = 0 column < a[row].length; column = column + 1) {
Invalid variable declaration
> for (int row = 0; row < a.length; row = row + 1) {
    for (int column = 0; column < a[row].length; column = column + 1) {
      System.out.printf( "%3d ",a[row][column]); 
    }
    System.out.println();
  }
  1   2   3   4 
 -1   4 
 -3  -2  -1 


import java.util.*; 

class One {
  public static void main(String[] args) {
    int[][] a = new int[0][]; 
    Scanner in = new Scanner(System.in); 
    while (true) {
      System.out.println("enter> "); 
      String line = in.nextLine();  
      if (line.equals("bye")) break;
      int[] numbers = new int[0]; 
      Scanner tokens = new Scanner(line); 
      while (tokens.hasNext()) {
        numbers = Arrays.copyOf(numbers, numbers.length + 1); 
        numbers[numbers.length-1] = Integer.parseInt(tokens.next()); 
      }
      a = Arrays.copyOf(a, a.length + 1); 
      a[a.length - 1] = numbers;
      for (int[] row : a) {
        for (int elem : row)
          System.out.printf("%3d ", elem);
        System.out.println();
      }
    }
    
  }
}

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run One
enter> 
 [DrJava Input Box]
  1   2   3 
enter> 
 [DrJava Input Box]
  1   2   3 
  2   5 
enter> 
 [DrJava Input Box]
  1   2   3 
  2   5 
  4   3   5   2   6 
enter> 
 [DrJava Input Box]
  1   2   3 
  2   5 
  4   3   5   2   6 
  1   2   3   4   5 
enter> 
 [DrJava Input Box]
  1   2   3 
  2   5 
  4   3   5   2   6 
  1   2   3   4   5 
  5   5   0  -1 
enter> 
 [DrJava Input Box]