课程: Learning Java Collections

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Working with Maps

Challenge: Working with Maps

(upbeat music) - [Instructor] Okay, I hope you're up for the final challenge. In this challenge, the Landon Hotel has created another class named BookingService that manages the booking of guests into rooms in the hotel. They've started work on the class by adding a hash map named bookings. This map will store each room and its associated guests, but they need your help in completing a few methods. The first is the book method. It's provided with a room and a guest that would like to stay in the room. The method will place the guest in the room only if another guest is not staying within it. The return value of the method is a Boolean that indicates if placing the guest in the room was successful. The next method totalRevenue is used to obtain the current amount of revenue using a calculation that sums the rates of all booked rooms. You want to make sure that you complete these methods in the order they're specified.…

内容