4 Replies - 2060 Views - Last Post: 26 March 2009 - 08:21 AM Rate Topic: -----

#1 Graham g  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 24-March 09

Hotel Booking Assignment Help

Posted 26 March 2009 - 05:08 AM

Bare Bone's hotel company is trying out a new way of running hotels to try and survive the current dismal economic environment. They will allow checking in for one day only. Everybody will have to vacate their rooms and check in again if they want to stay another day. This saves money on planning and on administering forward bookings. Another unusual aspect of the new regime is that they are charging only by room type.
You are being asked to write a VB application which will process the check in and check out proceedings.
The application will store the data for all rooms in a group of arrays.
 one array is for the room numbers
 one for the room type (Single, Double, Triple, Quadruple)
 one for the number of occupants in the room.
The application should be done in two parts, but only one application must be submitted:
 Part 1 will require the information for each room in the hotel to be entered from the keyboard at the beginning of business each day. People can check out (based upon room number) and check in (separate form) based upon this data.
 Part 2 will have all that information stored on file and when it is started in the morning will load all that data into the arrays in memory. When the program is shut down in the evening it will overwrite the data on file with the new room states.
Your Part 1 should operate like HotelBookings2.exe.
 This has only four hotel rooms
 starts off by asking the user to enter the data for those rooms
This part of the program has no proper data validation (no try-catch exceptions etc) but you can leave it like that because it will not be used in Part 2 which is the finished product. However it is important that your code prevents the user putting more people in the room than the room can hold after clicking the “Check In” button.
Some work has already been done and the skeleton code is in Form1.vb and CheckIn.vb.
Use of Functions and Subs will get marks.
There should be one Sub of the type
GetRoomTypeAndPrice(i, strRoomType, dblPrice)
If you want to use any of the public attributes of Form1 in CheckIn.vb then you can use
Form.attribute-name e.g Form1.strRoomNos(i)
Part 2 uses files. Part 2 will have all that information stored on file and when it is started in the morning will load all that data into the arrays in memory. When the program is shut down in the evening it will overwrite the data on file with the new room states.

Here is the code that I have for the CheckIn.Vb Form

Public Class CheckIn
	Private intCurrent As Integer
	Private intGuests As Integer
	Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
	   

	End Sub

	Private Sub cmbRoomType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbRoomType.SelectedIndexChanged
		Start()

		If cmbRoomType.SelectedItem = "Double" Then
			cmbGuests.Items.Clear()
			cmbGuests.Items.Add(1)
			cmbGuests.Items.Add(2)
		ElseIf cmbRoomType.SelectedItem = "Triple" Then
			cmbGuests.Items.Clear()
			cmbGuests.Items.Add(1)
			cmbGuests.Items.Add(2)
			cmbGuests.Items.Add(3)
		ElseIf cmbRoomType.SelectedItem = "Quadruple" Then
			cmbGuests.Items.Clear()
			cmbGuests.Items.Add(1)
			cmbGuests.Items.Add(2)
			cmbGuests.Items.Add(3)
			cmbGuests.Items.Add(4)

		End If




	End Sub

	Private Sub cmbGuests_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbGuests.SelectedIndexChanged
		Start()
	End Sub
	Private Sub Start()
		'Make sure no room is selected
		intCurrent = -1

		'The Guests should be 0 before they are selected
		intGuests = 0
	End Sub


	Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
		Me.Hide()
		Form1.Show()
	End Sub

	Public Sub Prepare()
		Start()
		txtRoomNumber.Clear()
		cmbGuests.SelectedIndex = 0
		cmbRoomType.SelectedIndex = 0
	End Sub

	Private Sub btnFindRoom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindRoom.Click

	End Sub



Here is the code that I have for the Form1.vb
Public Class Form1
	Public Const intMAXROOMS As Integer = 4
	Public strRoomNos(intMAXROOMS - 1) As String
	Public intOccupants(intMAXROOMS - 1) As Integer
	Public intBeds(intMAXROOMS - 1) As Integer
	Public Const dblSINGLEROOM As Double = 50.0
	Public dblDOUBLEROOM As Double = 90.0
	Public dblTRIPPLEROOM As Double = 125.0
	Public dblQUADRUBLEROOM As Double = 160.0


	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		FillArrays()
	End Sub

	Private Function FillArrays() As Integer
		Dim i As Integer

		For i = 0 To intMAXROOMS - 1
			strRoomNos(i) = InputBox("Room Number", "Input Room Number")
			Dim blnInputOk As Boolean
			Do
				blnInputOk = True

				Try

					intBeds(i) = CInt(InputBox("Beds Spaces", "Input Beds"))
					If intBeds(i) < 1 Or intBeds(i) > 4 Then
						MessageBox.Show("Input Out of Range")
						blnInputOk = False
					End If
					intOccupants(i) = CInt(InputBox("Occupants", "Input Occupants"))

				Catch ex As Exception
					MessageBox.Show("Input Error")
					blnInputOk = False
				End Try
			Loop Until blnInputOk


		Next

	End Function

	Private Sub btnCheckIn_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckIn.Click
		Me.Hide()
		CheckIn.Prepare()
		CheckIn.Show()
	End Sub

	Private Sub btnCheckOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckOut.Click
	 

	End Sub


	Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
		Me.Close()
	End Sub
End Class


Is there anyone on this forum that can provide urgent assistance. :D

*** MOD EDIT: Added code tags. Please :code: ***

This post has been edited by Graham g: 26 March 2009 - 07:29 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Hotel Booking Assignment Help

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Hotel Booking Assignment Help

Posted 26 March 2009 - 05:35 AM

1. Please edit your post to add the CODE tags:

:code:

2. Please post your code attempting to implement the assignment.

[rules][/rules]

This post has been edited by n8wxs: 26 March 2009 - 05:38 AM

Was This Post Helpful? 0
  • +
  • -

#3 Graham g  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 24-March 09

Re: Hotel Booking Assignment Help

Posted 26 March 2009 - 07:31 AM

View Postn8wxs, on 26 Mar, 2009 - 04:35 AM, said:

1. Please edit your post to add the CODE tags:

:code:

2. Please post your code attempting to implement the assignment.

[rules][/rules]


I have redited the code..

View PostGraham g, on 26 Mar, 2009 - 06:30 AM, said:

View Postn8wxs, on 26 Mar, 2009 - 04:35 AM, said:

1. Please edit your post to add the CODE tags:

:code:

2. Please post your code attempting to implement the assignment.

[rules][/rules]


I have redited the code and sincere appologies for not adding in the code between the brackets.I am so sorry.

Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: Hotel Booking Assignment Help

Posted 26 March 2009 - 08:06 AM

And other than posting your assignment verbatim, you have asked us nothing. You need to ask us specific questions.
Was This Post Helpful? 0
  • +
  • -

#5 Graham g  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 24-March 09

Re: Hotel Booking Assignment Help

Posted 26 March 2009 - 08:21 AM

View PostJackOfAllTrades, on 26 Mar, 2009 - 07:06 AM, said:

And other than posting your assignment verbatim, you have asked us nothing. You need to ask us specific questions.


Hi Jack,

Can you help me with these parts?

 one array is for the room numbers
 one for the room type (Single, Double, Triple, Quadruple)
 one for the number of occupants in the room.

P.S. I am finding arrays to be a very complicated concept to grasp, so any help that you can provide, will be of great help to me.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1