
import java.awt.Rectangle;

public class ClassesAndObjects {

	public static void main(String[] args) {
		//Group data and methods into classes
		//Build objects - intances of classes
		
		//String a class, "hello" is an object
		//msg is reference to the object
		String msg = "hello";
		
		//Rectangle is a class
		//x, y, width, height
		//use new to create the object
		//calls a constructor (special method for creating objects)
		Rectangle r1 = new Rectangle(10, 20, 100, 200);
		
		//accessor (getter) method
		System.out.println(r1.getWidth());
		
		//mutator (setter) method
		r1.setSize(150, 200);
		System.out.println(r1.getWidth());
		
		
		//make a dice object
		//use the default constructor (no arguments)
		// since one was defined, the default is not provided
		Dice d6 = new Dice(6);
		
		//d6.setSides(6);

		System.out.println(d6.getCurrentValue());
		
		//roll the dice
		d6.roll();
		
		System.out.println(d6.getCurrentValue());
		
		//20 sided die
		Dice d20 = new Dice(20);
		
		for(int i = 0; i < 5; i++) {
			d6.roll();
			d20.roll();
			
			System.out.printf("d6 rolled a %d\n", d6.getCurrentValue());
			System.out.printf("d20 rolled a %d\n", d20.getCurrentValue());
		}
		
		//can't do these
		//Dice.roll(); can;t call like this
		//d6.currentValue = 5;
	}

}
