1 00:00:00,000 --> 00:00:04,859 [MUSIC] 2 00:00:04,859 --> 00:00:08,182 Now that the book and patron classes have been fleshed out a little more, 3 00:00:08,182 --> 00:00:11,800 let's keep going with the patron class methods we discussed earlier. 4 00:00:11,800 --> 00:00:14,080 Check out and return book. 5 00:00:14,080 --> 00:00:16,940 The check out method is going to utilize all of the things we did in 6 00:00:16,940 --> 00:00:18,350 this last stage. 7 00:00:18,350 --> 00:00:21,390 This method will receive one argument, a book object. 8 00:00:21,390 --> 00:00:23,520 What do you think will happen next? 9 00:00:23,520 --> 00:00:26,430 Well, first we should set the patron's current book property 10 00:00:26,430 --> 00:00:28,920 to the book object that was passed in. 11 00:00:28,920 --> 00:00:31,380 This way, when a library employee looks up a patron, 12 00:00:31,380 --> 00:00:34,590 they will see what book, if any, that patron has checked out. 13 00:00:35,750 --> 00:00:39,620 Then we can set all the associated properties on the book object. 14 00:00:39,620 --> 00:00:42,440 Its out property should be set to true. 15 00:00:42,440 --> 00:00:46,710 It's patron property should be set to the patron object itself. 16 00:00:46,710 --> 00:00:50,570 That can be accomplished by setting the property to the this keyword. 17 00:00:50,570 --> 00:00:55,570 This, when used by itself inside a class, refers to the entire object. 18 00:00:55,570 --> 00:00:59,580 Finally, the book's dueDate property should be calculated and set. 19 00:00:59,580 --> 00:01:03,820 For our purposes, books will be due two weeks, or 14 days, from checkout. 20 00:01:05,470 --> 00:01:09,270 The return book method, is basically the inverse of the check out method. 21 00:01:09,270 --> 00:01:12,640 The book that's being returned, is passed in as an argument, 22 00:01:12,640 --> 00:01:15,240 the patron's current book property should be set back to null, 23 00:01:15,240 --> 00:01:17,860 since they're no longer borrowing the book. 24 00:01:17,860 --> 00:01:19,550 The book should be marked back in, and 25 00:01:19,550 --> 00:01:22,660 as a result, its due date property will be set back to null. 26 00:01:22,660 --> 00:01:25,630 Then we set the book's patron property back to null as well. 27 00:01:26,920 --> 00:01:29,000 I've attached a work space to this video. 28 00:01:29,000 --> 00:01:31,540 Open it up and try to code these out on your own. 29 00:01:31,540 --> 00:01:35,110 There's a read me file inside the work space with detailed instructions. 30 00:01:35,110 --> 00:01:39,080 When you're done, or if you get stuck, head to the next step to see the solution. 31 00:01:39,080 --> 00:01:41,460 Remember, everything you're doing is just for practice.