Hi all,

I am a first year student at northeastern and my VB professor assigned me a project that i am just stuck on. This is my first programming course and i honestly am a newbie at it so i hope you guys can help. Here is my situation.

A parking garage charges a 10 minimum fee to park for up to three hours. the garage charges an addtional 3.25 per hour excess of three hours. the maximum charge for any given 24-hour period is 40.00. Parking validation from a merchant allos a 10% discount on the total charges. a parking pass provides parking for up to 12 hours at no charge with a charge of 3.25 for each addtional hour or part thereof. customers with a husky card get 5 hours free with the 3.25 per hour chagre for all remaining hours. Assume that no car parks for longer than 24 hours at a time. wrtie a program that will calculate and display the parking charges for each customer who parked his or her car in this arage. You should enter the hours parked for each customer along with their license plate number and state. If they are from NJ,CT or NY add an addtional 5.00 for an obnoxiia surcharge.

I have designed the GUI if anyone is up to take a look i can either email it to you or send it to you over Aim. Thanks again.

11 Years
Discussion Span
Last Post by rex24

This coding was done by comatose he was awesome and extremely helpful in explaining and making a newbie like myself understand VB alittle more clearly. The comments were also done by comatose to help the user understand what he is actually doing step by step. Here is the complete program code. To make this project work.

' /* Declare Variables */
Dim hours
Dim total As Single
Dim mdiscount As Single
Dim pass As Integer
Dim card As Integer

Dim Plate As String
Dim fee As Integer
Dim feeRate As Single
Dim allDay As Integer
Dim FreeTime As Integer

Private Sub cmdExit_Click()
' /* This Code Unloads ALL THE FORMS in the project */
Dim XFrm
' /* For every Form in our project */
For Each XFrm In Forms
    ' /* Unload The Form */
    Unload XFrm
Next XFrm
End Sub

Private Sub cmdOK_Click()
' /* Get The Value In The TextBox, and Return It as An Integer */
hours = txtParked.Text
' /* Get The Plate Number */
Plate = txtPlates.Text

' /* Check If They Left The Hours Blank */
If hours = "" Then
    ' /* If So alert the User */
    MsgBox "Please Enter The Amount Of Time In The Parking Lot"
    ' /* Exit The Sub Routine */
    Exit Sub
End If

' /* Check If They Left The License Plate Box Blank */
If Plate = "" Then
    ' /* If So, Alert the User */
    MsgBox "Enter The License Plate"
    ' /* Exit This Sub */
    Exit Sub
End If
 If total >= 40 Then
    total = 40
End If

' /* If They Don't have a pass */
If chkPass.Value = 0 Then
    ' /* They Get Three Hours Without being charged additional Time fee */
    FreeTime = 3
    ' /* Set The Total They Owe To The Value Of Fee (10 bucks) */
    total = fee
' /* If They DO Have A Pass */
ElseIf chkPass.Value = 1 Then
    ' /* They Get 12 Hours Free */
    FreeTime = 12
    ' /* With No Charge */
    total = 0
End If

' /* If They Have A Husky Pass */
If chkHusky.Value = 1 Then
    ' /* Add 5 Hours To The Free Time They Get Before Additional 3.25 Charge */
    FreeTime = FreeTime + 5
End If

' /* Total Hours Will Be Hours Entered, Minus However much Time They Get Free */
hours = hours - FreeTime

' /* If Hours Is Less Than Or Equal To 0, They User Doesn't Owe Anything */
If hours <= 0 Then
    ' /* NO Charge */
    total = 0
    ' /* Otherwise, They Owe Something */
    ' /* So, set tmp to hours remaining (after free time) times 3.25 (feeRate) */
    tmp = hours * feeRate
    ' /* Total Equals Total Ammount They Owe, PLUS The Value of Tmp (3.25 * whatever) */
    total = total + tmp
End If

' /* If They are From a Crappy state */
If OptState.Value = True Then
    ' /* Add 5 to what they owe */
    total = total + 5
End If

' /* If They Have A Merchant Pass */
If chkMerchant.Value = 1 Then
    ' /* Get 10 percent of the total */
    tmp = total * mdiscount
    ' /* Subtract whatever 10% of the total is, from the total */
    total = (total - tmp)
End If
If total >= 40 Then
    total = 40
End If

' /* Set The Label To The Total */
lblCharge.Caption = total

End Sub

Private Sub Form_Load()
fee = 10
feeRate = 3.25
allDay = 40
mdiscount = 0.01
End Sub

Hi! Simon, Im a student just like you
please send me your GUI coz im also stuck on how to design.
Help me Simon,
My email is <EMAIL SNIPPED>

Edited by peter_budo: Keep It On The Site - Do not post asking for an answer to be sent to you via email or PM.


please help me simon i am a student i wnt to make project like you so please give me your project this is my e mail address <EMAIL SNIPPED>

Edited by peter_budo: Keep It On The Site - Do not post asking for an answer to be sent to you via email or PM.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.