Refer to the code below to create a similar IF…Then… Else statement on similar s
ID: 3691024 • Letter: R
Question
Refer to the code below to create a similar IF…Then… Else statement on similar situation: (20 pts.)
If decFlightCost <300D And decHotelCost < 120D Then
lblTripleMessage.Text = “Your business trip is approved”
Else
lblTripeMessage.Text = “Your business trip is denied”
End If
Give an example of a For… Next Loop and explain using an application the characteristics of the process. (20 pts.)
Fix the code: (40 pts.)
Private Sub btnItemNumber_Click (By Val sender As System.Object, ByVal e As System.EventArgs) Handles btnItemNumber.Click
Dim decCost as Decimal
Dim intCount As Decimal
decCost = Convert.ToDecimal(txtCost.Text)
Inventory(decCost, intCount)
End Sub
Private Sub Inventory (ByVal cost, ByVal count)
Count +=3
Cost *=1.3
End Sub
VISUAL BASIC coding format
Explanation / Answer
1.
If decFlightCost <300 And decHotelCost < 120 Then
lblTripleMessage.Text = “Your business trip is approved”
Else
lblTripeMessage.Text = “Your business trip is denied”
End If
2.
Private Sub btnItemNumber_Click (By Val sender As System.Object, ByVal e As System.EventArgs) Handles btnItemNumber.Click
Dim decCost as Decimal
Dim intCount As Decimal = 0
decCost = Convert.ToDecimal(txtCost.Text)
Inventory(decCost, intCount)
End Sub
Private Sub Inventory (ByVal cost as Decimal, ByVal count as Decimal)
Count +=3
Cost *=1.3
End Sub