Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Now that we've fleshed out our classes and objects and updated our plan of attack, let's revisit writing the `checkOut()` and `returnBook()` methods on the Patron class.
Instructions for Workspace
Your instructions are as follows:
1) Inside the Patron class, add two methods: checkOut()
and returnBook()
- The
checkOut()
method should receive one argument, a Book object. - It should update the
currentBook
property to the Book object that's passed in. - It should update that Book object's
out
property totrue
. - It should update that Book object's
patron
property to the Patron object itself - It should calculate the due date (14 days in the future) and then set the Book object's
dueDate
property to that due date.
- The
returnBook()
method should receive one argument, a Book object. - It should update the
currentBook
property tonull
- It should update that Book object's
out
property tofalse
- It should update that Book object's
patron
property tonull
- It should update that Book object's
dueDate
property tonull
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up