This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hey, I'm trying to get this hotel booking system sorted out so I can put a customer in a certain room, but i'm not really sure how to do it exactly. Would really appreciate some help, all the stuff I've tried so far has been a complete failure :/
(I wasn't really sure what to title this, sorry)
By looking at your code, I think you can create a enum data type for room type (to improve, just what i think ). Also, in the bedroom constructor, you have a if condition, which i think is not so clear. accepting 'n' and 'r' values as parameters. then you assign them back (with a hard coded values). you would put something more realistic. it is something i can think of by brief look. I hope it helps
Joined: Aug 03, 2010
the if statement is: there are only rooms 201-> 212 and rooms 201 to 203 are single rooms, therefore have a different rate to the double which are 204-> 212
If this is a continuation of your previous thread, in the future, don't start a new one.
The code where you set a rate is... highly local:So... what impact does this code have outside the constructor itself? (Hint: none.) You set a parameter you pass in to the method: isn't your goal to set the rate for the room? Where/in what variable is the room rate visible to anything that might use it? Where is the parameter "r" visible?