wood burning stoves 2.0*
The moose likes Java in General and the fly likes help with a booking system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "help with a booking system" Watch "help with a booking system" New topic
Author

help with a booking system

Robert Staniforth
Greenhorn

Joined: Aug 03, 2010
Posts: 11
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)







moh oo
Greenhorn

Joined: Aug 08, 2010
Posts: 2
hi,
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
Robert Staniforth
Greenhorn

Joined: Aug 03, 2010
Posts: 11
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
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2713
    
    5

Welcome to Javaranch moh moh oo .
Please check your Private messages.


SCJP, SCWCD.
|Asking Good Questions|
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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?
Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 47
Hey Robert,

To start with I see following two problems with your code:

  • First, In the constructor of your class Bedroom, you are trying to set the values for the input arguments.




  • It should be something like this



    Trying changing that and see if it works
  • Second, is the more fundamental problem of OOPS. You are trying to put the business logic in the classes that represent that your entities. To start with you can have the following approach:






  • Then add a following class that will hold your logic for bookings


    Thanks and Regards
    P Manchanda
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: help with a booking system
     
    Similar Threads
    Saving details of rooms
    Search A Vector
    Adding JLabels to a vector
    Quick Question
    if statement