Advertisement
artkr

namesrfer

Dec 13th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. /*
  2. * File: NameSurferEntry.java
  3. * --------------------------
  4. * This class represents a single entry in the database. Each
  5. * NameSurferEntry contains a name and a list giving the popularity
  6. * of that name for each decade stretching back to 1900.
  7. */
  8.  
  9. import acm.util.*;
  10. import java.util.*;
  11.  
  12. public class NameSurferEntry implements NameSurferConstants {
  13.  
  14. /* Constructor: NameSurferEntry(line) */
  15. /**
  16. * Creates a new NameSurferEntry from a data line as it appears
  17. * in the data file. Each line begins with the name, which is
  18. * followed by integers giving the rank of that name for each
  19. * decade.
  20. */
  21. public NameSurferEntry(String line) {
  22. // You fill this in //
  23. }
  24.  
  25. /* Method: getName() */
  26. /**
  27. * Returns the name associated with this entry.
  28. */
  29. public String getName() {
  30. // You need to turn this stub into a real implementation //
  31. return null;
  32. }
  33.  
  34. /* Method: getRank(decade) */
  35. /**
  36. * Returns the rank associated with an entry for a particular
  37. * decade. The decade value is an integer indicating how many
  38. * decades have passed since the first year in the database,
  39. * which is given by the constant START_DECADE. If a name does
  40. * not appear in a decade, the rank value is 0.
  41. */
  42. public int getRank(int decade) {
  43. // You need to turn this stub into a real implementation //
  44. return 0;
  45. }
  46.  
  47. /* Method: toString() */
  48. /**
  49. * Returns a string that makes it easy to see the value of a
  50. * NameSurferEntry.
  51. */
  52. public String toString() {
  53. // You need to turn this stub into a real implementation //
  54. return "";
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement