Please use the [*code] and [/code] tags next time :)
Option Strict On
Public Class videoBonanzaSaleForm
Inherits System.Windows.Forms.Form
' Declare Constants
Const DVD_PRICE_Decimal As Decimal = 2.5D
Const NEW_RELEASE_DVD_Decimal As Decimal = 3D
Const VHS_PRICE_Decimal As Decimal = 1.8D
Const NEW_RELEASE_VHS_Decimal As Decimal = 2D
Const DISCOUNT_RATE_Decimal As Decimal = 0.1D
' Declare module-level variables.
Dim customerCountInteger As Integer
Dim grandTotalDecimal, totalDecimal, itemAmountDecimal As Decimal
Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
' Calculate and display the current amounts.
Dim priceDecimal, discountDecimal As Decimal
If titleTextBox.Text <> "" Then
If dvdRadioButton.Checked = True Or vhsRadioButton.Checked = True Then
' Find the price.
<strong>If dvdRadioButton.Checked Then
If newReleaseCheckBox.Checked Then
priceDecimal = NEW_RELEASE_DVD_Decimal
Else
priceDecimal = DVD_PRICE_Decimal
End If
ElseIf vhsRadioButton.Checked Then
If newReleaseCheckBox.Checked Then
priceDecimal = NEW_RELEASE_VHS_Decimal
Else
priceDecimal = VHS_PRICE_Decimal
End If
End If </strong>
' Calculate the extended price and add to order total.
If memberCheckBox.Checked Then
discountDecimal = priceDecimal * DISCOUNT_RATE_Decimal
Else
discountDecimal = 0
End If
itemAmountDecimal = priceDecimal - discountDecimal
totalDecimal += itemAmountDecimal
itemAmountLabel.Text = itemAmountDecimal.ToString("C")
totalLabel.Text = totalDecimal.ToString("C")
Else
MessageBox.Show("A Movies Format Must Be Selected", "Data Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
MessageBox.Show("A Title Must Be Entered.", "Data Enrty Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
titleTextBox.Focus()
End If
' Allow a change only for a new order.
memberCheckBox.Enabled = False
' Allow clear after an order has begun.
clearButton.Enabled = True
' Reset format Radio Buttons and clear text box.
vhsRadioButton.Checked = False
dvdRadioButton.Checked = False
titleTextBox.Clear()
End Sub
The part I changed is in bold.
The problem was you were saying it like this:
1.IF It's a DVD or VHS THEN
1a. IF It's a DVD THEN
1a1. Set the it to regular DVD
1b. IF it's a VHS THEN
1b1. Set it to a regular VHS
1c. IF It's a New DVD
1c1. Then Set it to new dvd
1d. IF It's a new VHS THEN
1d1. Set it to a new VHS
2. END IF
Let's say a customer choose New Release VHS.
The computer would read through those instructions like this:
1. = True
1a. = False
1b. = True
1b1. it would set the value here
2.
You were thinking it would go like this:
1. = true
1a. = false
1b. = true
1b1. set the value
1c = false
1d = true
1d1. re set the value
2
Hope this helps explain it a bit :)