Question: Programming Assignment #3: The Social Class For this project you will write a class Person. A Person has a name (assume a first name only,
Programming Assignment #3: The Social Class For this project you will write a class Person. A Person has a name (assume a first name only, with no spaces) and friends. Store the names of the friends in a string, separated by spaces. Provide a constructor that constructs a person with a given name and no friends. Provide the following methods: public String getName() public void befriend(Person p) public void unfriend(Person p) public String getFriendNames() public int getNumberOfFriends() Functional Requirements The befriend and unfriend methods ought to be one-directional. In other words, typing Alicebefriend(bob) should add Bob to Alices list of friends, but not Alice to Bobs list. To do the latter, youll have to call bob. befriend(Alice), as I do in my unit tester. (Note that this requirement is here to make your programming job easier. It takes more work to make the befriend method symmetrically; that is, to make Alice. befriend(bob) simultaneously add Bob to Alices list and Alice to Bobs list.) When run alongside the main class in the unit tester I have posted on Moodle, you should get results equivalent to the results I recorded in the screenshot (see the following page). The class should be tested a few different ways, for I will also test it with a different unit tester that I am not posting on Moodle. Methodological Requirements Every class, every instance variable, every constructor, every method, and every parameter/return value should have a comment. No more requirements just make it work! Advice Try using the replace method of the String class within your unfriend method.
.
Facebook CobberNet m 22712.202101: Project X > Project3 (1.pdf X + WIFI Business - Google x C Get Homework Help W X > Project pai.pdf X + c File C:/Users/auguf/OneDrive/Desktop/Etsy%20Products/Project3%20pdf.pdf TO G Apps d The Star Wars Holid... Love Gin The Ne.. Watch Meet the Fo... V Amazing China Do... Zurvive DayZ & AR. 9780135226018-IE. BAP072 Partial Exa Other bookmarks Projects pdf.pdf 2/2 93% + Alice has 3 friends Eve Charlie Doug Alice SHOULD have 3 friends: Eve Charlie Doug Bob has 1 friends: Doug Bob SHOULD have 1 friends: Doug Charlie has 2 friends: Alice Francine Charlie SHOULD have 2 friends: Alice Prancine Doug has 2 friends: Alice Bob Doug SHOULD have 2 friends: Alice Bob Eve has 1 friends: Alice Eve SHOULD have 1 friends! Alice Francine has 1 friends! Charlie Francine SHOULD have 1 friends: Charlie 1 2 Now some drama enauea... ------------------------ Alice has 2 friends: Eve Doug Alice SHOULD have 2 friends: Eve Doug Bob has 1 friends: Doug Order does not matter Bob SHOULD have 1 friends: Doug Charlie has 0 friends in your lists - only the Charlie SHOULD have o friends! contents do Doug has 3 friends: Alice Bob Francine Doug SHOULD have 3 friends: Alice Francine Bob Eve has 1 friends! Alice Eve SHOULD have i friends: Alice Francine has 1 friends: Doug Francine SHOULD have 1 friends: Doug BUILD SUCCESSFUL (total time: 0 seconds) Type here to search O 9 Project pdf.pdf Steam Communi.. 0 Project 3 - NetBe.. B Zoom Meeting 12:33 PM 1/29/2021
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
