Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: JAVA PROGRAMING QUESTION, Hotel Reservation Sysytem

  1. Oct 23, 2011 #1
    System Requirements:
    Congratulations! Your software company BestSolutions Ltd has won the contract to
    develop a new hotel reservation system for the L4 chain of hotels (check out
    l4hotels.com! ...or something similar). At present the chain consists of a 5-star, 4-star and
    3-star hotel but the chain may expand or contract in the future. The reservation system
    needs to handle reservations, cancellations, hotel stays (check-in, check-out) and billing.

    A booking/reservation can be either a standard booking (S) or an advance purchase
    booking (AP). A 5% discount applies to all AP reservations.

    The cancellation policy is as follows:
    Advance purchase bookings are non-refundable. For a standard booking, the full booking value will be charged if the cancellation is received within 48 hours of arrival or if the booking is a ‘no-show’.

    A very simple reservation would allow one room to be reserved. However the contract
    with L4 states that a single reservation should facilitate many room bookings.

    Reservation information should be maintained on the system (i.e. in a comma separated
    value (csv) file). Reservations can be removed from the system one month after the date
    of departure, given that the reservation has been processed (this probably means changed to a cancellation or a hotel stay). The following is the type of information that should be
    recorded for a reservation:
    Reservation number
    Reservation name
    Reservation type (S/AP)
    Check-in date
    Number of nights
    Number of rooms
    For each room
    o Room type
    o Occupancy (number of adults/children)
    o Breakfast included
    Total cost

    L4 requires that all hotel stay information and cancellation information should also be
    maintained on the system (again in separate csv files). This information must be stored
    for at least 7 years for tax and audit purposes.

    One of the main reasons that BestSolutions won the tender for this contract was that it
    proposed to provide some analysis on the hotel stays and billing data for L4 hotels. This
    analysis will provide L4 hotels with the ability to better assess their current offerings,
    including room prices and to tailor special packages in the future. This data analysis
    should provide occupancy figures/rates for each of the hotels and room type over a
    specific period of time. The billing/accounts information should provide a summary of
    the financial status of the business. Any of this data could be requested for monthly,
    weekly or daily intervals or for specific days over the period. The requested data should
    be output to (a) comma separated value (csv) file(s).
    There will be three types of users for the system: supervisors, hotel desk personnel and
    customers. A customer will be able to make reservations and cancellations. A hotel desk
    administrator will also be able to make reservations and cancellations for a customer.
    They will also be able to handle check-in and check-out services. A supervisor will be
    able to do all the things that a hotel desk administrator can do but may also be able to
    apply discounts to bookings as well as requesting any of the data analysis described


    I know you can't give me an answer but i don't exactly know where to start, if someone could just nudge me in the right direction as to where to start that would be great.

    For my classes I'm thinking of

    A Hotel class
    A Room class
    A reservation class
    Customer class
    Staff class
    Supervisor class
    Statistics class

    I was given an excel with information about the 5, 4 and 3 star hotels.
    So there rooms available, min & max occupence and rates per day.

    Again Im only looking for a place to start, Do i need to read the information about the hotels to implement the class(es)

    Any help would be appreciated

    Thanks a million!!
    Last edited: Oct 23, 2011
  2. jcsd
  3. Oct 23, 2011 #2


    Staff: Mentor

    I don't think you should be concerning yourself with all of the classes you listed (hotel, room, staff, etc.). The one class that jumps out at me is for reservations.
  4. Oct 24, 2011 #3
    Thanks for the reply, So the reservation class should describe what a reservation is, and a reservation will have all those bits of info as mentioned.

    But when it says, For each room, room type, occupancy etc..
    so im going to need a class to describe that and Im going to have to read from the file about the hotels and display the relevant room info.
    Is that right so far?

    I'll try get up some code so at least I'll have a starting point, but ill focus on the reservation class first.
  5. Oct 24, 2011 #4


    Staff: Mentor

    You probably will need a Room class that maintains information about a single room. I don't think you need a Hotel class, as you could represent a hotel as an array of type Room.

    I don't see anything in the problem description that gives any details about room type. Is there additional information that you haven't posted?
  6. Oct 24, 2011 #5
    View attachment L4Hotels.txt

    This is a .csv file if you open it in excel it will show you all the information about a 5 ,4 and 3 star hotel so there rooms, amount available min and max occupancy and the rates per day. I think i uploaded it right
  7. Nov 13, 2011 #6
    Code (Text):

     while(correctDate ==  false)
                    System.out.println("Please enter the date you want to book. E.g 08 (8th of month)") ;
                    int day = input.nextInt() ;
                    if(day < 0 && day > 31)
                        System.out.println("Invalid day input \nTry again") ;
                        day = input.nextInt() ;

                    System.out.println("Please enter the month you want to book. E.g 03 (3rd month)") ;
                    int month = input.nextInt() ;
                    if(month < 0 && month > 12)
                        System.out.println("Invalid month input \nTry again") ;
                        month = input.nextInt() ;
                    month-- ;

                    System.out.println("Please enter the year you want to book. E.g 2012 (year)") ;
                    int year = input.nextInt() ;

                    System.out.println("Please enter the hour you would like to check in at. E.g 12(12 pm)") ;
                    int hour = input.nextInt() ;

                    System.out.println("Please enter the minutes you would like to check in at. E.g 12(12 pm)") ;
                    int min = input.nextInt() ;

                    Calendar calendar = new GregorianCalendar(year,month,day,hour,min) ;
                    Calendar current = new GregorianCalendar()   ;
                    checkOut = new GregorianCalendar(year,month,day,12,00) ;

                    checkIn = (Date)calendar.getTime() ;    

                    checkingOut = (Date)checkOut.getTime() ;

                    total  = 0 ;
                    for(int k = 0 ; k < numOfNights ; k++)

                        total = total + rate[checkIn.getDay() + k];

                    if(checkIn.before(current.getTime()) )
                        System.out.println("Date is in the past\nTry again!") ;

                        correctDate = true ;
  8. Nov 13, 2011 #7
    I'm trying to work out the rates of for the reservation. It calculates it for the period of a given week so if you book from Tuesday to Friday. it does that fine but if I say book from Saturday to Wednesday it doesn't work. so whenever there is a roll over into a new week it stops.

    Any suggestions?
  9. Nov 13, 2011 #8


    Staff: Mentor

    I don't see anything in your code that works with the days of the week (i.e., Tuesday and so on). Also, it doesn't seem that the problem you describe is a result of the code you showed in post 6. I could be wrong, but could the problem be occurring in some other code that you didn't show? I don't see where the rollover you mentioned is happening.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook