• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help with a booking system

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)







 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Javaranch moh moh oo .
Please check your Private messages.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic