This program gives you the option of picking 3 different rental cars. Jeep Wrangler which cost $55 per day, Grand Cherokee which cost $85 per day, and a Land Rover which cost $125 dollars per day. You also have an option to refill the gas for $52. The program needs to calculate the total cost.
here my code, but its didnt work:vb Code:
Private Sub Command1_Click() Dim sngWrangler As Single, sngGrand As Single Dim sngTotal As Single, sngRover, sngDays As Single 'assighn the variables sngDays = cboDays.Text 'make calculations sngTotal = (sngWrangler * sngDays) + (sngGrand * sngDays) + (sngRover * sngDays) 'display the results on the screen lblTotal.Caption = sngTotal End Sub Private Sub Form_Load() cboDays.AddItem 1 cboDays.AddItem 2 cboDays.AddItem 3 cboDays.AddItem 4 cboDays.AddItem 5 cboDays.AddItem 6 cboDays.AddItem 7 End Sub Private Sub optRover_Click() If optRover.Value = True Then sngRover = 125 Else sngRover = 0 End If End Sub Private Sub optWrangler_Click() If optWrangler.Value = True Then sngWrangler = 55 Else sngWrangler = 0 End If End Sub Private Sub optGrand_Click() If optGrand.Value = True Then sngGrand = 85 Else sngGrand = 0 End If End Sub Private Sub chkGas_Click() If chkGas.Value = 1 Then sngGas = 52 Else sngGas = 0 End If lblTotal.Caption = "" End Sub




Reply With Quote