'can select one of three types of vehicles. Customer has a choice of filling the gas tank themselves,
'or prepaying for a full tank of gas ($52). If vehicle will be driven by more than one driver, a multiple
'driver cost of $22 per day will be added to the cost."
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim wranglerCost As Single = 55
Dim cherokeeCost As Single = 85
Dim roverCost As Single = 125
Dim sngDays As Single
Dim totalCost As Single
Dim totalmultdrivers As Single
'calculation for multiple driver option ( 22 multipled by number of days)
totalmultdrivers = sngDays * 22
If IsNumeric(txtDays.Text) Then
sngDays = Convert.ToSingle(txtDays.Text)
If sngDays >= 1 And sngDays <= 7 Then
If radWrangler.Checked Then
'if user chooses no multiple drivers and no prepaid gas
'calculates right
If radNodrivers.Checked And radNoGas.Checked Then
totalCost = wranglerCost * sngDays
'if user chooses no mult drivers and yes to prepaid gas
'does not calc right
ElseIf radNodrivers.Checked And radYesGas.Checked Then
totalCost = wranglerCost * sngDays + 52
'if user chooses yes to mult drivers and yes to prepaid gas
'does not calc right
ElseIf radYesdrivers.Checked And radYesGas.Checked Then
totalCost = wranglerCost + totalmultdrivers * sngDays + 52
'if user chooses yes to mult drivers and no to prepaid gas
'does not calc right
ElseIf radYesdrivers.Checked And radNoGas.Checked Then
totalCost = wranglerCost + totalmultdrivers * sngDays
End If

New Topic/Question
Reply




MultiQuote





|