(Lab #2) |
Question: We're having trouble getting started with the lab today. What exactly needs to be done to the reservation class? And do the methods in the hotel class require references to the reservation class? My 100 class didn't do vectors at all last year, and Tak hasn't done programming in a while so things are a little fuzzy. We're just looking for some tips to get started. Answer: We've provided the skeleton for the reservation class -- but all of the methods are actually empty. You need to finish the implementation of each method so that it satisfies the purpose described in the comments.
Question: We're working on this lab and we're decomposing the application as a whole. The problem we're having is that we don't really understand what the reservation class does. It seems like the reservation class stores the reservations -- but isn't the hotel class the one with the vector? Maybe then the reservation class reads the info from the user, sets it as a reservation and passes it to the hotel class -- but then do we even need a separate class for that? Answer: The Reservation class models a reservation -- the binding between a person's name (a String) and a room (a number).
Question: For Lab 2, do we need to (or can we) edit/change the Simulation class provided to us? Are we not allowed to change any of the code in it? Answer: Feel free to edit it if you like, document changes that you make though is there something missing? do you want to hard code some test cases?
Question: For the Hotel file, after the vector rooms is created, do we add Reservation objects , room numbers( in the form of Integer objects) or peoples' names? (strings) Also do we add in the room numbers ourselves or do can we create a file of rooms and feed that in? (like a .txt file) Answer: Please add reservation objects to the Hotel's Vector. The Vector models the Hotel rooms and the only property wee need to maintain is the Reservation information.
Question: Can it be assumed that the user won't type in a letter when requesting a room number? or do we need to deal with that scenario? Answer: The Sim class already handles this, so you don't have to. Woo hoo!
Question: Can it be assumed that multiple entries of the same name are not entered in to the Vector rooms? (i.e. there are not 2 different people named "David" with reservations)? or does it even matter if this is the case? Answer: David could reserve two different rooms, that's fine. Be sure that when David cancels, both rooms get cleared.
Question: Can it be assumed that the user won't select the "reserveN" command and then request a room number that is greater than [rooms.size() - 1 ]? Answer: Of course not, people are always trying to cheat the system and you can bet they'll try to give you bad room numbers! There is already a way of handling errors, namely returning false. You should not build more rooms.
Question: Is it okay to resubmit updated assignments multiple times as long as we do it before the due date/time? Answer: Yup, that'll be fine. but please only put source files in there.
Question: I was just wondering what time on tuesday the program is going to be due, is it midnight or before class or anytime? Answer: The lab is due at 11:59pm on Tuesday.
Question: We presumed that it should be done in the hotel class in reserveroom method where only name of person is given so should we create a counter and make the different room numbers Answer: When you call the version of reserveRoom() that has only one paramter, the name, you may assign the room number any way you'd like -- just so long as the room isn't already occupied (people don't like sharing their beds, well, with those other than of their own choice).
Question: How do you link the name of the person with the room number? Answer: This is the role of the Reservation class. It models this pairing
Question: How doese one keep track of reservation number in order to delete So if use sends information to cancel reservation will he give his name and room number then you search for it in the vector class and delete it or you keep and reservation number with each new reservation recieve that from the user and then delete the corresponding vector cell Answer: The reservations are organized by the Vector within the Hotel class. |