/** The class Name manages one name, its sex and a collection of ranks for that name. */ abstract class Name { - String name - char sex - ArrayList< Integer > ranks - int START_YEAR = 1900 - int HIGH_RANK = 1001 - String SEPARATOR = "\\s+" + Name() + Name( String name, char sex ) /** Define accessors. */ + char getSex() + String getName() + ArrayList< Integer > getRanks() + String toString() } /** The class BabyName manages a name with ranks starting from 1900. Each rank has a value from 0 to 1000. A rank of zero indicates that the name did not appear among the 1000 most popular names for a baby in a particular year. */ class BabyName extends Name implements Comparable< BabyName > { /** Construct a BabyName object from a String called line @param line, a string separated by spaces of the form name sex rank ... */ + BabyName( String line ) /** getCumulativeRank returns a QueriedName object for a baby with a cumulative rank from start to end year. @param startYr, integer for year from 1900 on @param endYr, integer for year from 1900 on @return a QueriedName object with a cumulative rank */ + QueriedName getCumulativeRank( int startYr, int endYr ) /** getRankCount returns a QueriedName object for a baby with a count of the ranks from start to end year that fell between low and high rank inclusive. @param startYr, integer for year from 1900 on @param endYr, integer for year from 1900 on @param lowRank, a low rank between 1 and 1000 @param highRank, a high rank between 1 and 1000 @return a QueriedName object with a count */ + QueriedName getRankCount( int startYr, int endYr, int lowRank, int highRank ) + int compareTo( BabyName right ) } /** The class QueriedName manages one name that occurs in response to a particular query. */ class QueriedName extends Name implements Comparable< QueriedName > { + QueriedName( String name, char sex, int rank ) + QueriedName( String name, char sex, ArrayList< Integer > ranks ) + int compareTo( QueriedName right ) } /** The class PopularNames manages a collection of BabyName objects. */ class PopularNames { - ArrayList< BabyName > names - String FILE_NAME popularNames + PopularNames() + void load( String fileName ) + ArrayList< Integer > find( String name, char sex ) + ArrayList< QueriedName > findRanks ( boolean isCumulative, char sex, int firstYear, int lastYear ) } /** The class Query manages one particular query on the information in a PopularNames object. */ class Query { - PopularNames names + Query() + String findAverageAndStandardDeviation( String name, char sex, int startYr, int endYr ) + ArrayList< QueriedName > findRanks( boolean isCumulative, char sex, int firstYear, int lastYear, int lowRank, int highRank ) + ArrayList< Integer > findRanks ( String name, char sex, int startYr, int endYr ) } /** The class ClientIO manages interaction with the client of the software system. */ { - Query query + ClientIO() + processQueries() - findAverageAndStandardDeviation() - findRanks() - findTopN() } /** The class Test creates a ClientIO object. */ class Test { + main( String [] args ) { }