Question need some help with a program

eclass

Active member
Joined
Jul 6, 2011
Messages
27
Programming Experience
Beginner
The program is a hotel occupancy form
The Hotel has eight floors and 30 rooms oneach floor. I'm supposed to create aapplication that calculates the occupancy rate for the hotel. Theoccupancy rate is the percentage of rooms occupied, and may becalculated by dividing the number of rooms occupied by the number ofrooms. For example, if 18 rooms on the first floor are occupied, the occupancyrate is: 18/30 = .6 or 60%.
The form has two out labels called totalrooms occupied and overall occupancy rate that holds two output text boxes todisplay the numbers
its only three buttons Calculate report,close, and exit Its obvious what the exit buttons issupposed to do the clear button should clear all the controls on the floor

Now the complete report button is supposedto loop and iterate eight times. Each time the loop iterates, it should displaya input box for one of the hotel floor. The input box should ask the user asksthe user the user to enter the number of rooms occupied on each floor. As theuser enters a value for each floor, the loop should calculate the occupancyrate for that floor and display the information for that floor in a list box.When the number of occupied rooms has been entered for all floors theapplication should display total number of rooms occupied an overall occupancyrate for the hotel. (the hotel has a total of 240 rooms total)
here is the code I have so far
 Option Strict On
Option Explicit On
 
Public Class frmHotelOccupancy
 
    Private SubbtnCompleteReport_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles btnCompleteReport.Click
        DimstrNumberRooms As String
        DimintTotalRooms As Integer = 240
        DimintRoomsOccupied As Integer = 30
        DimintOccupiedRooms As Integer = 0
 
        Do
            '  Get  number of rooms from the user
           strNumberRooms = InputBox("Enter the number of rooms occupied on thefloor", "Number of Rooms")
            '  Add the new item to the list
           If CInt(strNumberRooms) < 30 Then
               lstHotelOccupancy.Items.Add(strNumberRooms)
           End If
            '  Until they don't make an entry
        Loop Until(strNumberRooms.Trim = "Rooms occupied")
        'Calculationfor determining the rooms occupied
 
        'Loop for 8floors and percentage of rooms occupied
 
        '
    End Sub
 
    Private SubbtnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles btnClear.Click
 
    End Sub
 
    Private SubbtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles btnExit.Click
 
    End Sub
End Class


If someone can answer me back soon it wouldbe so appreciated, Thanks
 
How can anyone help when you haven't asked a question?
 
I can tell you one thing that is wrong if it is actually in your program code, when you are declaring your variables Dim is not seperate from everything else. If you would like, please give a specific error message that you ar getting. also in your If statement you would probably need an else and.
 
Most of us are already 'attacking' numerous projects - asking us to look at your brief and suggest a solution is really not the purpose of these forums (and unlikely to happen)

If you run into problems developing solutions using VB.NET, then you'll likely find some advice on resolving those problems here... there are, generally, a hundred different ways to solve a problem, most of which will be equally as viable and totally dictated by personal taste, experience and, a lot of the time, the direction the wind is blowing ;)
 
Maybe I can give you some newbie pointers from one to another.
First thing, the other guy was right, you need to split the dim and your variables
ex: dim strnumberrooms as string

secondly, i am not sure why you have so many variables; ur using one as a string and then converting it. maybe you should use a variable in integer instead, and then using it in your string, using .tostring

thats just me. hope it helps.
 
Back
Top