public class Car2   //call drive() from class, not from a new object
					//(miles is static var, and drive() is static)
{
	static int miles, total;
	String dir;

	public static void main(String[] args)
	{
		drive(10, "south");
		drive(40, "west");
		drive(100, "east");
		drive(200, "west");
	}



	public static void drive (int miles, String dir)
	{
		total+=miles;	// miles will be totaled to the whole class
		System.out.println("Driving " +dir+ " " +miles+ " miles");
		System.out.println("  Total miles " +total);
	}
}