Ocean Tours Visual Basic

Only available on StudyMode
  • Topic: Mathematics, Statement, Class
  • Pages : 8 (1010 words )
  • Download(s) : 583
  • Published : March 17, 2012
Open Document
Text Preview
Program Name: Ocean Tours Trip Selection
' Author: Fernando Fresnillo
' Date: 03/09/2012
' Purpose: The Ocean Tours Trip Selection application determines the ' ocean tours available and calculates the cost of the tour. Option Strict On
Public Class frmTours
' Class variables
Private _intTwoHours As Integer = 2
Private _intThreeHours As Integer = 3
Private _intFourHours As Integer = 4
Private _intEightHours As Integer = 8
Private _strDeepSeaFishing As String = "Deep Sea Fishing" Private _strKayaking As String = "Kayaking"
Private _strScuba As String = "Scuba"
Private _strSnorkeling As String = "Snorkeling"
Private _strGlassBottomBoat As String = "Glass Bottom Boat" Private _strParasailing As String = "Parasailing"
Private Sub cboIsland_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboIsland.SelectedIndexChanged ' This event handler allows the user to enter the island choice ' and then calls subprocedures to place the island activities in the list. Dim intIslandChoice As Integer

intIslandChoice = Me.cboIsland.SelectedIndex
lstTours.Items.Clear()
Select Case intIslandChoice
Case 0

ArubaTours()
Case 1
JamaicaTours()
Case 2
KeyWestTours()
End Select
' Make items visible in the window
lblParty.Visible = True
txtNumberInParty.Visible = True
lblSelect.Visible = True
lstTours.Visible = True
btnFindCost.Visible = True
btnClear.Visible = True
lblTourType.Visible = True
lblCost.Visible = True
lblLength.Visible = True
' Clear all labels
lblTourType.Text = ""
lblCost.Text = ""
lblLength.Text = ""
' Set focus on the number in party text box
txtNumberInParty.Focus()
End Sub
Private Sub ArubaTours()
' This procedure fills in the possible ocean tours from Aruba

lstTours.Items.Add(_strDeepSeaFishing)
lstTours.Items.Add(_strKayaking)
lstTours.Items.Add(_strScuba)
lstTours.Items.Add(_strSnorkeling)
End Sub
Private Sub JamaicaTours()
' This procedure fills in the possible ocean tours from Jamaica lstTours.Items.Add(_strGlassBottomBoat)
lstTours.Items.Add(_strParasailing)
lstTours.Items.Add(_strSnorkeling)
End Sub
Private Sub KeyWestTours()
' This procedure fills in the possible ocean tours from Key West lstTours.Items.Add(_strDeepSeaFishing)
lstTours.Items.Add(_strGlassBottomBoat)
lstTours.Items.Add(_strScuba)
lstTours.Items.Add(_strSnorkeling)
End Sub
Private Sub btnFindCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindCost.Click Dim intGroupSize As Integer
Dim blnNumberInPartyIsValid As Boolean = False
Dim blnTourIsSelected As Boolean = False
Dim intTourChoice As Integer
Dim strSelectedTour As String
Dim intIslandChoice As Integer

Dim intLengthOfTour As Integer
Dim decTotalCost As Decimal
' Call a function to ensure the number of people in the party is valid blnNumberInPartyIsValid = ValidateNumberInParty()
' Call a function to ensure a tour was selected
intTourChoice = ValidateTourSelection(blnTourIsSelected, strSelectedTour) ' If number of people and the tour selection are valid, calculate the cost If (blnNumberInPartyIsValid And blnTourIsSelected) Then intGroupSize = Convert.ToInt32(txtNumberInParty.Text) intIslandChoice = Me.cboIsland.SelectedIndex

Select Case intIslandChoice
Case 0
decTotalCost =...
tracking img