/**
* Michael Bergen
* CS171Z
* Final Project
* 12/07/11
* This code is my own work. It was written without consulting 
code written by other students. Michael Bergen
*/

public class City implements Comparable
{
    private String name;
    private double longitude;
    private double lattitude;
    
    public City(){
        setName("");
        setLocation(0.0, 0.0);
    }
    
    public City(String n, double lat, double lon){
        setName(n);
        setLocation(lat, lon);
    }
    
    public void setName(String n){
        name = n;
    }
    
    public void setLocation(double lat, double lon){
        longitude = lon;
        lattitude = lat;
    }
    
    
    public String getName(){
        return name;
    }
    
    public double getLongitude(){
        return longitude;
    }
    
    public double getLattitude(){
        return lattitude;
    }
    
    //Comaprable interface: compares based on alphabetical order of name
    public int compareTo(Object other){
        return getName().compareTo(((City)other).getName());
    }
    
    public String toString(){
        //determine the number of tabs necessary to make the rows even
        String tabs = "\t";
        if(name.length() <= 7)
            tabs += "\t";
            
        return name + tabs + lattitude + "\t" + longitude;
    }
}
