fork download
  1. /*
  2. * File: FacePamphletProfile.java
  3. * ------------------------------
  4. * This class keeps track of all the information for one profile
  5. * in the FacePamphlet social network. Each profile contains a
  6. * name, an image (which may not always be set), a status (what
  7. * the person is currently doing, which may not always be set),
  8. * and a list of friends.
  9. */
  10. import acm.graphics.*;
  11. import java.util.*;
  12. public class FacePamphletProfile implements FacePamphletConstants {
  13. /**
  14. * Constructor
  15. * This method takes care of any initialization needed for
  16. * the profile.
  17. */
  18. public FacePamphletProfile(String name) {
  19. // You fill this in
  20. }
  21. /** This method returns the name associated with the profile. */
  22. public String getName() {
  23. // You fill this in. Currently always returns the empty string.
  24. return "";
  25. }
  26. /** This method returns the image associated with the profile.
  27. * If there is no image associated with the profile, the method
  28. * returns null. */
  29. public GImage getImage() {
  30. // You fill this in. Currently always returns null.
  31. return null;
  32. }
  33. /** This method sets the image associated with the profile. */
  34. public void setImage(GImage image) {
  35. // You fill this in
  36. }
  37. /** This method returns the status associated with the profile.
  38. * If there is no status associated with the profile, the method
  39. * returns the empty string ("").
  40. */
  41. public String getStatus() {
  42. // You fill this in. Currently always returns the empty string.
  43. return "";
  44. }
  45. /** This method sets the status associated with the profile. */
  46. public void setStatus(String status) {
  47. // You fill this in
  48. }14
  49. /** This method adds the named friend to this profile's list of
  50. * friends. It returns true if the friend's name was not already
  51. * in the list of friends for this profile (and the name is added
  52. * to the list). The method returns false if the given friend name
  53. * was already in the list of friends for this profile (in which
  54. * case, the given friend name is not added to the list of friends
  55. * a second time.)
  56. */
  57. public boolean addFriend(String friend) {
  58. // You fill this in. Currently always returns true.
  59. return true;
  60. }
  61. /** This method removes the named friend from this profile's list
  62. * of friends. It returns true if the friend's name was in the
  63. * list of friends for this profile (and the name was removed from
  64. * the list). The method returns false if the given friend name
  65. * was not in the list of friends for this profile (in which case,
  66. * the given friend name could not be removed.)
  67. */
  68. public boolean removeFriend(String friend) {
  69. // You fill this in. Currently always returns false.
  70. return false;
  71. }
  72. /** This method returns an iterator over the list of friends
  73. * associated with the profile.
  74. */
  75. public Iterator<String> getFriends() {
  76. // You fill this in. Currently always returns null.
  77. return null;
  78. }
  79. /** This method returns a string representation of the profile.
  80. * This string is of the form: "name (status): list of friends",
  81. * where name and status are set accordingly and the list of
  82. * friends is a comma separated list of the names of all of the
  83. * friends in this profile.
  84. *
  85. * For example, in a profile with name "Alice" whose status is
  86. * "coding" and who has friends Don, Chelsea, and Bob, this method
  87. * would return the string: "Alice (coding): Don, Chelsea, Bob"
  88. */
  89. public String toString() {
  90. // You fill this in. Currently always returns the empty string.
  91. return "";
  92. }
  93. }
Runtime error #stdin #stdout 0.01s 4980KB
stdin
Standard input is empty
stdout
Standard output is empty