// things we will look at in lecture 5
// commenting and uncommenting will cause the various lines
// to be executed.
class Lecture5 {
  
  public static void main(String[] args) {
  int i, j;  
    // 1) Constants    
  // Why do we use constants? 
  final int INCHES_FEET = 12; // number of inches in a foot
  
  // what if we try to change a constant?
  //INCHES_FEET = 14;
  
  // 2) Evaluation order with strings
  // How will the following statements be evaluated?
//  int m = 3, n = 4;
//  System.out.println("m: " + m); // a) what does the + do here?
//  System.out.println(m + n);     // b) what does the + do here? Why is it different?
//  System.out.println("m" + "n"); // c) what does the + do here?
//  System.out.println("m + n: " + m + n);   // d) all of the plusses?
//  System.out.println("m + n: " + (m + n)); // e) all of the plusses?
//  System.out.println("mn: " + m * n);      // f) what is different here?
//  System.out.println(m + n + "m + n");     // g) is this the same as d)?  Why/why not?
//  System.out.println(m + n + (m + n));     // h) what happens here?
  
//  System.out.println("\n"); // just some space
    
//    // 3) Using ++ and --
    i = 2;
    j = 3;
    i = (++j + 4) * ++j;
//    // Step                       Expression               i  j
//    // Start                      i = (j++ + 4) * ++j;     2  3
//    // Evaluate j++, Increment j  i = (3 + 4) * ++j;       2  4
//    // Increment j, Evaluate ++j  i = (3 + 4) * 5;         2  5
//    // Add 3 + 4                  i = 7 * 5;               2  5
//    // multiply 7 by 5            i = 35;                  2  5
//    // assign 35 to i             35                       35 5
//    
    //System.out.println("(++j + 4) * ++j \n i = " + i + "\n j = " + j);
//    
//    // Using similar reasoning how would it work here?
//    i = 2;
//    j = 3;
//    i = (j-- + 4) * --j;
//    
//    System.out.println("(j-- + 4) * --j \n i = " + i + "\n j = " + j);

//    // 4) additional operators +=, -=, *=, /= , %=
    System.out.println("i = 5");
    i = 5;
    i += 5;
    System.out.println("i += 5 = " + i);
    i = 5;
    i += 5 * 2;
    System.out.println("i += 5 * 2 = " + i);
    i = 5;
    i += 5 + 2;
    System.out.println("i += 5 + 2 = " + i);
//    
//    // what is happenning here?
//    // lets try multiplication - remember that multiplication has higher
//    // precedence than addition
//    i = 5;
//    i *= 5;
//    System.out.println("i *= 5 = " + i);
    i = 5;
    i *= 5 * 2;
    System.out.println("i *= 5 * 2 = " + i);
    i = 5;
    i *= 5 + 2;
    System.out.println("i *= 5 + 2 = " + i);
//    // what do these other operators really mean: -=, /= , %=
    
    // Arithmetic and characters (section 2.5 in text)
    char c = 'W';
    System.out.println("c = " + c);
//   char c = 'W';
    c++;  // increments
    System.out.println("c = " + c);
    char c1 = 'D';
    char c2 = 'q';
    System.out.println("diff between D and q = " + (c1-c2));
//    c = c + 1; // is this ok?  if not .. what do we need to do?
//    System.out.println("c = " + c);
//    c = '8';
//    i = c - '0';
//    System.out.println("i = '8' - '0' = " + i);
//    // so we can have relative difference between characters as int
//    // or we can add numbers to characters to identify new characters
//    
//    
    // AND NOW FOR OUR QUESTION PERIOD!!! 
  
  // extra time .. lets look at the Math module.

 
  }
}