package OOPLS;

public class PostalRecord implements RadixSortElement {
    int zip;
    String name, address1, address2, city, state;
    public int radix() { return 10; }
    public int digitsInKey() { return 5; }
    public int getDigit(int i) { 
        int digit = zip;
        while (--i > 0) digit /= 10;
        return digit % 10;
    }
    public PostalRecord(String name, String address1,
                        String address2, String city, 
                        String state, String zip) 
            throws Exception {
        this.name = name;
        this.address1 = address1;
        this.address2 = address2;
        this.city = city;
        this.state = state;
        this.zip = Integer.parseInt(zip);
    }
}
