Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Object Interaction!
You have completed Practice Object Interaction!
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
currentBookproperty to the Book object that's passed in. - It should update that Book object's
outproperty totrue. - It should update that Book object's
patronproperty to the Patron object itself - It should calculate the due date (14 days in the future) and then set the Book object's
dueDateproperty to that due date.
- The
returnBook()method should receive one argument, a Book object. - It should update the
currentBookproperty tonull - It should update that Book object's
outproperty tofalse - It should update that Book object's
patronproperty tonull - It should update that Book object's
dueDateproperty 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