public int countInts(int[] data, int n) {
    int count = 0;
    for(int i=0; i<data.length; i++) {
	if(n == data[i]) {
	    count++;
        }
    }
    return count;
}

public Customer implements Comparable {
    private String name, ssn;
  
    public Customer(String name, String ssn) {
	this.name = n;
        this.ssn = ssn;
    }

    public String getName() {
	return name;
    }

    public String getSSN() {
	return ssn;
    }

    public int compareTo(Object rhs) {
        Customer other = (Customer)rhs;
        if(name.equals(other.getName())) {
	    return ssn.compareTo(other.getSSN());
        } else {
            return name.compareTo(other.getName());
        }
    }

    public boolean equals(Object rhs) {
	if(rhs instanceof Customer) {
	    Customer other = (Customer)rhs;
	    return name.equals(rhs.getName()) && ssn.equals(rhs.getSSN());
        } else {
	    return false;
	}
    }
}

public String[] startsWithA(String[] data) {
    int count = 0;
    for(int i=0; i<data.length; i++) {
	if(data[i].charAt(0) == 'A') {
	    count++;
	}
    }

    String[] result = new String[count];
    int j=0;
    for(int i=0; i<data.length; i++){ 
	if(data[i].charAt(0) == 'A') {
	    result[j] = data[i];
	    j++;
	}
    }
    return result;
}

public String[] startsWithA(String[] data) {
    SimpleList<String> copy = new SimpleList<String>();
    for(int i=0; i<data.length; i++) {
	if(data[i].charAt(0) == 'A') {
	    copy.add(data[i]);
	}
    }    

    String[] result = new String[copy.size()];
    copy.reset();
    int k=0;
    while(copy.hasNext()) {
	result[k] = copy.next();
	k++;
    }
    return rseult;
}

public SimpleList<Oval> toList(Oval[] ovals){ 
    SimpleList<Oval> result = new SimpleList<Oval>();
    for(int i=0; i<ovals.length; i++){ 
	result.add(ovals[i]);
    }
    return result;
}

public GettableList<ItemType> extends SimpleList<ItemType> {
    public GettableList() {
	super();
    }

    public ItemType getNth(int n) {
	if(n < 0 || n >= size()) return null;

	ItemType result = null;
	reset();
	int ndx = -1;
	while(ndx < n) {
	    result = next();
	    ndx++;
	}
	return result;
    }
}
	    


