Class notes Intro Java week 2
-----------------------------
1. Primitive data types
   A. Integer: long, *int*, short, byte
   B. Floating point: *double*, float
      i.   Sign bit (0 = +, 1 = -)
      ii.  Mantissa (base 2 fraction)
      iii. Exponent (2 to the power of this)
      floatingpointnumber = sign * 1.mantissa * 2^exponent
   C. Boolean: boolean
   D. Character: char
      i. Unicode, with first 128 chars ASCII
2. Abstract data types (ADTs)
   A. Anything that is not a primitive is an ADT
   B. In chapter two, you will care about String and
      Rectangle, the latter of which should not be
      confused with what a graphics tool can draw
3. The below class can be used to visualize rectangles
   in an applet.  Create a JApplet, call it RectApplet,
   then copy and paste this in and run it as an applet.
---
import java.awt.*;
import javax.swing.JApplet;

public class RectApplet extends JApplet {
	Rectangle r1 = new Rectangle(25,50,350,100);
	Rectangle r2;
	Rectangle r3;
	
	public void init() {
		setSize(700,400);
		r2 = new Rectangle(10,125,400,300);
		r3 = r1.intersection(r2);
		System.out.println(r1);
		System.out.println(r2);
		System.out.println(r3);
	}
	
	public void paint(Graphics g) {
		g.setColor(Color.red);
		g.fillRect(r1.x, r1.y, r1.width, r1.height);
		g.setColor(Color.green);
		g.fillRect(r2.x, r2.y, r2.width, r2.height);
		g.setColor(Color.blue);
		g.fillRect(r3.x, r3.y, r3.width, r3.height);
	}
}