
import java.awt.Rectangle;

public class ClassesAndObjects {

	public static void main(String[] args) {
		//class e.g. String
		
		//object e.g. "Hello"
		// variable msg: reference to a String
		String msg = "Hello";
		
		//create a Rectangle object
		//data: x, y, width and height
		
		//create the object with the keyword new
		//a special method called a constructor
		Rectangle r1 = new Rectangle(10, 20, 100, 20);
		
		//getWidth: accessor/getter method
		System.out.println(r1.getWidth());
		
		//setSize: mutator/setter method
		r1.setSize(150, 200);
		System.out.println(r1.getWidth());
		
		
		//create a Dice object
		//no-argument constructor Dice (default constructor)
		//now use the 1-arg constructor
		Dice d6 = new Dice(6);
		
		System.out.println(d6.getCurrentValue());
		
		d6.roll();

		System.out.println(d6.getCurrentValue());
		
		Dice d20 = new Dice(20);
		
		for(int i = 0; i < 5; i++) {
			d6.roll();
			d20.roll();
			
			System.out.printf("d6  rolled %d\n", d6.getCurrentValue());
			System.out.printf("d20 rolled %d\n", d20.getCurrentValue());
		}
		
		//Can't do:
		//d6.currentValue = 12;  //since currentValue is private
		//Dice.roll(); roll is not static
				
	}

}
