import java.io.IOException;
import java.io.StreamTokenizer;

/* 
 * Score - this class represents the name and the
 * score a player obtained.
 * Eric Mcreath - 2006
 */

public class Score implements Comparable {
    String name;
    Integer score;
    
    public Score(String n, Integer s) {
    	name = n;
    	score = s;
    }
    
    public String toString() {
    	return "\"" + name + "\" " + score;
    }

	public int compareTo(Object o) {  // scores are order based on the value
		                              // the score(highest first)
		return name.compareTo(((Score)o).name);
	}

	public static Score parse(StreamTokenizer stream) throws IOException {		
		String name = ParseTools.parseQuote(stream);
		Integer score = ParseTools.parseInteger(stream);
		return new Score(name, score);
	}
}

