/*******************************************************
 *	CSC A06 Tutorial III				*
 *	Prepared By Eric Beiers				*
 * 							*
 * 	Class Name: Car.java				*
 * 							*
 * 	Purpose: This class represents a car,		*
 *		 and holds variables to represent	*
 *		 its various charactoristics.		*
 * 							*
  *******************************************************/


public class Car {
	// static variables are common to all occurances of an object
	private static int numberOfCars = 0;

	// default values for all the variables of the class
	private int numWheels = 4;
	private int doors = 2;
	private String colour = "Red";
	private String model = "Sport Wagon";
	private boolean CDPlayer = false;
	private boolean isTurnedOn = false;


	// Constructor for Car Class
	public Car() {
		numberOfCars++;
	}

	// Constructor for Car Class, modifies default variables in car class
	public Car(int numWheels, int doors, String colour, String model, boolean CDPlayer, boolean isTurnedOn) {
		numberOfCars++;
		this.numWheels = numWheels;
		this.doors = doors;
		this.colour = colour;
		this.model = model;
		this.CDPlayer = CDPlayer;
		this.isTurnedOn = isTurnedOn;
	}

	// switches car on and off
	public void UseKey() {
		isTurnedOn = !isTurnedOn; 
	}

	// prints info about this car
	public void PrintDescription() {

		System.out.println("This car has:");
		System.out.println("     Wheels: " + this.numWheels);
		System.out.println("     Number of Doors: " + this.doors);
		System.out.println("     Colour: " + this.colour);
		System.out.println("     Model: " + this.model);

		if (this.CDPlayer) { 
			System.out.println("     It has a CD Player");
		} else {
			System.out.println("     It does not have a CD Player.");
		}

		if (this.isTurnedOn) { 
			System.out.println("      .. and finally, it is turned ON.");
		} else {
			System.out.println("      .. and finally, it is turned OFF.");
		}
		
	}


}  
sitemap