package car;

import java.util.Calendar;

class Car {
	String make;
	String model;
	int year;
	String color;
	String owner;
	Location location;
	int mileage;

	public Car(String make,String model,String color,Location location) {
		this.make=make;
		this.model=model;
		this.year = Calendar.getInstance().get(Calendar.YEAR);
		this.color = color;
		this.owner = make; // Initial owner is the factory
		this.location = location;
		this.mileage=0;
	}

	public void sell(String newOwner) { this.owner = newOwner; }
	public String locate() { return this.location.toString(); }
	public void drive(Location newLoc) {
		this.mileage+=this.location.distance(newLoc);
		this.location = newLoc;
	}
	public void repaint(String newColor) { this.color=newColor; }

	public String describe() {
		return "" + year + " "  + color + " " + make + " " + model +
			" at " + location.toString() + " mileage=" + mileage;
	}
}
