MCS-177 Project 10: Facebook

Start: Wednesday 5/14; Due: Wednesday 5/21 @ 4:00pm (no late project will be accepted!)


Overview

In this project, you will continue to experiment with building your own Python classes. Many of you log into Facebook and interact with your friends. You will build classes to represent a text-version of Facebook.

This project is out of 20 points and offers up to 2 extra credit points once the project is complete. You can skip anything shown in blue and come back to finish it later for more credits.

We stongly encourage you to work on this project with a partner.

Example

Here is an example of how all the classes come together to make our Facebook work. This output reflects implementation of all the extra credit features.

>>> TextFacebook = Facebook()
>>> TextFacebook.registerUser('Bob', 'bob@gmail.com')
>>> TextFacebook.registerUser('Alice', 'alice@gac.edu')
>>> TextFacebook.registerUser('Charles', 'charlie@hotmail.com')
>>> TextFacebook.login('Bob')
>>> TextFacebook.addFriend('Alice')
>>> TextFacebook.postStatus('is working on Project 10!')
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10!
>>> TextFacebook.logout()
>>> TextFacebook.login('Charles')
>>> TextFacebook.addFriend('Alice')
>>> TextFacebook.postStatus('is going to watch Star Trek Into Darkness.')
>>> TextFacebook.viewStatus()
(1) Charles is going to watch Star Trek Into Darkness.
>>> TextFacebook.logout()
>>> TextFacebook.login('Alice')
>>> TextFacebook.viewProfile()
Alice (alice@gac.edu)
Friends: Bob and Charles
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10!
(1) Charles is going to watch Star Trek Into Darkness.
>>> TextFacebook.likeStatus(1)
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10!
(1) Charles is going to watch Star Trek Into Darkness.
Alice likes this.
>>> TextFacebook.commentOnStatus(0, 'Poor you... Have a cookie!')
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10!
Alice: Poor you... Have a cookie!
(1) Charles is going to watch Star Trek Into Darkness.
Alice likes this.
>>> TextFacebook.logout()
>>> TextFacebook.login('Bob')
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10!
Alice: Poor you... Have a cookie!
>>> TextFacebook.commentOnStatus(0, "It's all right. The project is a lot of fun!")
>>> TextFacebook.postStatus("finished working on Project 10! Woohoo!")
>>> TextFacebook.logout()
>>> TextFacebook.login('Alice')
>>> TextFacebook.viewStatus()
(0) Bob is working on Project 10
Alice: Poor you... Have a cookie!
Bob: It's all right. The project is a lot of fun!
(1) Charles is going to watch Star Trek Into Darkness.
Alice likes this.
(2) Bob finished working on Project 10! Woohoo!

Specific tasks

  1. Implement the Comment class in comment.py such that:

  2. Implement the Status class in status.py such that:

  3. Implement the User class in user.py such that:

  4. Implement the Facebook class in facebook.py such that:

Note

Remember not to print anything in the __str__ method. You should accumulate ONE string that contains all the information and return it.

Submitting your work

You will be submitting your code using Moodle; click on the following link for instructions on submitting code using Moodle. For this project, you will need to submit the following files:

Grading

You will earn one point for each of the following accomplishments: (Project 10 is still out of 20 points. In other words, you may earn up to 2 points of extra credits in this project.)

  1. You have all the instance variables necessary for the Comment class.

  2. You have all the accessor and mutator methods for all the instance variables in the Comment class.

  3. The __str__ method in the Comment formats the code correctly.

  4. You have all the instance variables necessary for the Status class.

  5. You have all the accessor and mutator methods for all the instance variables in the Status class.

  6. The __str__ method in the Status class formats the code correctly.

  7. The addLike and addComment methods are implemented correctly.

  8. You have all the instance variables necessary for the User class.

  9. You have all the accessor and mutator methods for all the instance variables in the User class.

  10. The __str__ method in the User class formats the code correctly.

  11. The addFriend method links two users as friends correctly in the User class.

  12. The isFriend method checks if the given user is a friend or not correctly.

  13. You have all the instance variables necessary for the Facebook class.

  14. The registerUser method adds a new user to Facebook correctly.

  15. The login and logout methods log in and out a user correctly and print out an error message when appropriate.

  16. The addFriend method correctly links two users as friends in the Facebook class.

  17. The viewProfile method displays the information about the current user correctly.

  18. The viewStatus method displays only the status of the currently logged-in user and his/her friends, formatting the statuses correctly and printing out an error message when appropriate.

  19. The postStatus method adds a new post by the user correctly. It prints out an error message when appropriate.

  20. The likeStatus and commentOnStatus methods behave correctly. They print out an error message when appropriate.

  21. The __str__ method of the status class uses the grammatically correct format.

  22. The __str__ method of the user class uses the grammatically correct format.