| | |
Hotel Occupancy formHelp
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
i'm new to visual basic and I managed to make somewhat of an assignment I need. now it's not perfect but, I am terrible when it comes to calculations... what am I doing wrong? ;-;
' This procedure calculates and displays each floors
' occupancy rate.
Dim intCount As Integer ' Loop counter
Dim decoccupancy As Decimal ' occupancy rate
' Calculate the occupancy rate for each floor, the total
' of all occupancy rates , and the total rooms occupied.
For intCount = 0 To intMAX_floor = 250
decoccupancy = introoms(intCount) * decroom_occupancy_RATE
decoccupancyrate(intCount) = decoccupancy
decTotaloccupancyrate /= decoccupancy
intTotalrooms &= Int(intCount)
it's telling me to divie the number of rooms by the occupied rooms... 18/30 = .6 or 60%
and the hotel has 240 rooms
Not sure wat direction to go in now.... Thanks
' This procedure calculates and displays each floors
' occupancy rate.
Dim intCount As Integer ' Loop counter
Dim decoccupancy As Decimal ' occupancy rate
' Calculate the occupancy rate for each floor, the total
' of all occupancy rates , and the total rooms occupied.
For intCount = 0 To intMAX_floor = 250
decoccupancy = introoms(intCount) * decroom_occupancy_RATE
decoccupancyrate(intCount) = decoccupancy
decTotaloccupancyrate /= decoccupancy
intTotalrooms &= Int(intCount)
it's telling me to divie the number of rooms by the occupied rooms... 18/30 = .6 or 60%
and the hotel has 240 rooms
Not sure wat direction to go in now.... Thanks
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#2 22 Days Ago
this is what i have so far can someone help pelaseee?
VB.NET Syntax (Toggle Plain Text)
Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click 'This procedure clears all labels and list box. ListBox1.Items.Clear() lblOccupancyRate.Text = String.Empty lblTotalRooms.Text = String.Empty End Sub Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click 'This calculates and displays each floors occupancy rate. Dim decOccupancy As Array Dim decTotalOccupancyRate As Decimal Dim strUserInput As String Dim decTotalOccupancy As Decimal Dim intCount As Integer 'ListBox1.Items.Add 'Calculate the occupancy rate for each floor, the total of all occupancy rates, and the total rooms occupied. For intCount As Integer = 0 To 7 strUserInput = InputBox("Enter the number of rooms occupied. Provide a value") decOccupancy(intCount) = CDec(strUserInput) / 30 ListBox1.Items.Add(decOccupancy(intCount)) decTotalOccupancy += CDec(strUserInput) Next Do ListBox1.Items.Add(decTotalOccupancy) ListBox1.Items.Add(decTotalOccupancy / 240) Loop If CInt(strUserInput) > 30 Then MessageBox.Show("Please enter a number greater than 0 and less than 30") End If 'Display the running total. lblOccupancyRate.Text = decTotalOccupancyRate.ToString("c")
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#3 22 Days Ago
The hotel has 8 floors and 30 rooms on each floor. Create an application that calculates the occupancy rate for each floor, and the overall occupancy rate for the hotel. The occupancy rate is the percentage of rooms occupied, and may be calculated by dividing the number of rooms occupied by the number of rooms.
When the user clicks the "Complete Report" button, a loop should execute and iterate 8 times. Each time the loop iterates, it should display an input box for one of the hotel's floors. The input box should ask the user to enter the number of rooms occupied on that floor. As the user enters a value for each floor, the loop should calculate the occupancy rate for that floor, and display the information for that floor in the list box. When the number of occupied rooms has been entered for all the floors, the application should display the total number of rooms occupied and the overall occupnacy rate of the hotel.
When the user clicks the "Complete Report" button, a loop should execute and iterate 8 times. Each time the loop iterates, it should display an input box for one of the hotel's floors. The input box should ask the user to enter the number of rooms occupied on that floor. As the user enters a value for each floor, the loop should calculate the occupancy rate for that floor, and display the information for that floor in the list box. When the number of occupied rooms has been entered for all the floors, the application should display the total number of rooms occupied and the overall occupnacy rate of the hotel.
•
•
Join Date: Sep 2009
Posts: 42
Reputation:
Solved Threads: 5
0
#4 22 Days Ago
1. You can't add rates, it just doesn't work
2. When you display percentages, multiply by 100
3. You are processing and THEN checking for user errors and doing nothing about it.
Instead force them to get it right before going on.
4. Don't assume the user entered correct data
5. Keeping track of the occupancy per floor makes more sense than the rate
How about this? (Used notepad so it may be a bit weird.):
2. When you display percentages, multiply by 100
3. You are processing and THEN checking for user errors and doing nothing about it.
Instead force them to get it right before going on.
4. Don't assume the user entered correct data
5. Keeping track of the occupancy per floor makes more sense than the rate
How about this? (Used notepad so it may be a bit weird.):
VB.NET Syntax (Toggle Plain Text)
'This calculates and displays each floors occupancy rate. Dim Occupancy(7) As Byte 'Why do you have an array that is going to be dropped Dim TotOccupancy As Byte = 0 '240 is < 255 - can't overflow Dim decOccupancyRate As Decimal Dim strUserInput As String Dim decOccupancy As Decimal Dim intCount As Byte Dim RoomCount As Integer 'User can say 2 billion and shouldn't overflow 'ListBox1.Items.Add For intCount As Integer = 0 To 7 RoomCount = 0 while RoomCount < 1 or RoomCount > 30 strUserInput = InputBox("Enter the number of rooms occupied. Provide a value") if isnumeric(strUserInput) then RoomCount = strUserInput if RoomCount < 1 or RoomCount > 30 then MessageBox.Show("Please enter a number greater than 0 and less than 30") End If end while Occupancy(intCount) = RoomCount TotOccupancy += RoomCount decOccupancyRate = CDec(RoomCount) / 30. ListBox1.Items.Add(decOccupancyRate*100) Next strUserInput = "Total occupancy= " & TotOccupancy.ToString() ListBox1.Items.Add(strUserInput) decOccupancyRate = CDec(TotOccupancy) / 240. ListBox1.Items.Add(decOccupancyRate * 100)
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#6 22 Days Ago
bah its not working...thing is i dont thing we r suppose to use bytes in this assignment...im so frustrated right now... Main problem now is cant to string to Integer and Byte to integer... Could i use Double insetad of byte? thign part where i cant String to integar is bolded
'This calculates and displays each floors occupancy rate.
Dim Occupancy(7) As Byte 'Why do you have an array that is going to be dropped
Dim TotOccupancy As Byte = 0 '240 is < 255 - can't overflow
Dim decOccupancyRate As Decimal
Dim strUserInput As String
Dim decOccupancy As Decimal
Dim Count As Byte
Dim RoomCount As Integer 'User can say 2 billion and shouldn't overflow
'ListBox1.Items.Add
For intCount As Integer = 0 To 7
RoomCount = 0
While RoomCount < 1 Or RoomCount > 30
strUserInput = InputBox("Enter the number of rooms occupied. Provide a value")
If IsNumeric(strUserInput) Then RoomCount = strUserInput
If RoomCount < 1 Or RoomCount > 30 Then
MessageBox.Show("Please enter a number greater than 0 and less than 30")
End If
End While
Occupancy(intCount) = RoomCount
TotOccupancy += RoomCount
decOccupancyRate = CDec(RoomCount) / 30
ListBox1.Items.Add(decOccupancyRate * 100)
Next
strUserInput = "Total occupancy= " & TotOccupancy.ToString()
ListBox1.Items.Add(strUserInput)
decOccupancyRate = CDec(TotOccupancy) / 240
ListBox1.Items.Add(decOccupancyRate * 100) Last edited by hhh0505; 22 Days Ago at 11:27 pm.
•
•
Join Date: Sep 2009
Posts: 42
Reputation:
Solved Threads: 5
0
#7 22 Days Ago
Hmmm, works for me. 'Course I did say it was from notepad
VB.NET Syntax (Toggle Plain Text)
'This calculates and displays each floors occupancy rate. Dim Occupancy(7) As Byte 'Why do you have an array that is going to be dropped Dim TotOccupancy As Byte = 0 '240 is < 255 - can't overflow Dim decOccupancyRate As Decimal Dim strUserInput As String Dim decOccupancy As Decimal Dim intCount As Byte Dim RoomCount As Integer 'User can say 2 billion and shouldn't overflow 'ListBox1.Items.Add For intCount = 0 To 7 RoomCount = -1 While RoomCount < 0 Or RoomCount > 30 strUserInput = InputBox("Enter the number of rooms occupied. Provide a value") If IsNumeric(strUserInput) Then RoomCount = strUserInput If RoomCount < 0 Or RoomCount > 30 Then MessageBox.Show("Please enter a number >= 0 and <= 30") End If End While Occupancy(intCount) = RoomCount TotOccupancy += RoomCount decOccupancyRate = CDec(RoomCount) / 30.0 ListBox1.Items.Add(decOccupancyRate * 100) Next strUserInput = "Total occupancy= " & TotOccupancy.ToString() ListBox1.Items.Add(strUserInput) decOccupancyRate = CDec(TotOccupancy) / 240.0 ListBox1.Items.Add(decOccupancyRate * 100)
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#8 22 Days Ago
yea i think im scerwed lo. thanks for the help... still not working
•
•
•
•
Hmmm, works for me. 'Course I did say it was from notepad
VB.NET Syntax (Toggle Plain Text)
'This calculates and displays each floors occupancy rate. Dim Occupancy(7) As Byte 'Why do you have an array that is going to be dropped Dim TotOccupancy As Byte = 0 '240 is < 255 - can't overflow Dim decOccupancyRate As Decimal Dim strUserInput As String Dim decOccupancy As Decimal Dim intCount As Byte Dim RoomCount As Integer 'User can say 2 billion and shouldn't overflow 'ListBox1.Items.Add For intCount = 0 To 7 RoomCount = -1 While RoomCount < 0 Or RoomCount > 30 strUserInput = InputBox("Enter the number of rooms occupied. Provide a value") If IsNumeric(strUserInput) Then RoomCount = strUserInput If RoomCount < 0 Or RoomCount > 30 Then MessageBox.Show("Please enter a number >= 0 and <= 30") End If End While Occupancy(intCount) = RoomCount TotOccupancy += RoomCount decOccupancyRate = CDec(RoomCount) / 30.0 ListBox1.Items.Add(decOccupancyRate * 100) Next strUserInput = "Total occupancy= " & TotOccupancy.ToString() ListBox1.Items.Add(strUserInput) decOccupancyRate = CDec(TotOccupancy) / 240.0 ListBox1.Items.Add(decOccupancyRate * 100)
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
Basically i have a listbox and the user should be prompetd to enter a value for each floor... 1-8 and you have to give a value for the amount of rooms occupied... then it displays it on the listbox once the loop in complete ...can someoen pelase help me with this code? im really close...
VB.NET Syntax (Toggle Plain Text)
'This calculates and displays each floors occupancy rate. Dim intOccupancy(7) As Integer Dim intTotOccupancy As Integer = 0 Dim decOccupancyRate As Decimal Dim strUserInput As String Dim decOccupancy As Decimal Dim intCount As Byte Dim intRoomCount As Integer 'User can say 2 billion and shouldn't overflow 'ListBox1.Items.Add For intCount = 0 To 7 intRoomCount = -1 While intRoomCount < 0 Or intRoomCount > 30 strUserInput = InputBox("Enter the number of rooms occupied. Provide a value") If IsNumeric(strUserInput) Then intRoomCount = strUserInput If intRoomCount < 0 Or intRoomCount > 30 Then MessageBox.Show("Please enter a number >= 0 and <= 30") End If End While intOccupancy(intCount) = intRoomCount intTotOccupancy += intRoomCount decOccupancyRate = CDec(intRoomCount) / 30 ListBox1.Items.Add(decOccupancyRate * 100) Next strUserInput = "Total occupancy= " & intTotOccupancy.ToString() ListBox1.Items.Add(strUserInput) decOccupancyRate = CDec(CDec(intTotOccupancy) / 240.0) ListBox1.Items.Add(decOccupancyRate * 100)
![]() |
Similar Threads
- Link exchange with travel, hotel, languages, education and courses sites (Relevant Link Exchanges)
- Hotel Reservation System (Database Design)
- why occupancy rate is 0? (Java)
- Link Exchange with Los Angeles Hotel Website (Relevant Link Exchanges)
- hotel management using Servlet (Java)
- Rate My Hotel Booking Site (Website Reviews)
- www.hotelreservationusa.com & www.hotel-reservation-usa.com (Websites for Sale)
Other Threads in the VB.NET Forum
- Previous Thread: Disabling dates before current date of a datetimepicker control
- Next Thread: Serial State Change Monitoring
| Thread Tools | Search this Thread |
"crystal .net .net2005 2008 access add advanced application array assignment basic beginner box button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees excel exists firewall forms html image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan picturebox picturebox2 port print printpreview record regex reports" reuse right-to-left save savedialog search serial settings socket sorting sqldatbase sqlserver storedprocedure string temp textbox timer txttoxmlconverter useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml





