Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java help NameRecord encapsulates the data for one name: the String name and its rank over the years. Use an int array to store the
Java help
NameRecord encapsulates the data for one name: the String name and its rank over the years. Use an int array to store the int rank numbers. The NameRecord constants START-1880 and END-2016 define the start and end years in the data. Methods: o Constructor-takes a String name and sets up the NameRecord object. o String getName0-returns the name o void setRank (int year, int rank) - sets the rank of the name in the given year. Use the convention that year-0 is 1880, year-l is 1881, and so on. int getRank(int year)- returns the rank of the name in the given year. Use the convention that year-0 is 1880, year-1 is 1881, and so on. o o int bestYearO returns the year where the name was most popular, using the earliest year in the event of a tie. Returns the actual year, for example 1920, so the caller does not need to adjust for START. It is safe to assume that every name has at least one year with a non-zero rankStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started