New and asking for help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New and asking for help

molyU2BabemolyU2Babe Posts: 2Member
Lynette Rifle owns an image consulting shop. Her clients can select from the following services at the specified regular prices:

Makeover $125, Hair Styling $60, Manicure $35, and Permanent Makeup $200. She has the distributed discount coupons that advertise discounts of 10 percent and 20 percent off the regular price. Create a project that will allow the receptionist to select a discount rate of 10 percent, 20 percent, or none, and then select a service. Display the total price for the currently selected service and the total due for all services. A visit may include several services.

Include Buttons for , Calculate, Clear, Print, and Exit.



This is what I have so far and it is not doing the calculations as I want it to do. Any advice, direction, help is much appreciated!




Public Class ImageShopForm
' Declare Constants.

Const TEN_PERCENT_DECIMAL As Decimal = 10D
Const TWENT_PERCENT_DECIMAL As Decimal = 20D
Const PERMANENT_MAKEUP_DECIMAL As Decimal = 200D
Const MAKEOVER_DECIMAL As Decimal = 125D
Const HAIR_STYLING_DECIMAL As Decimal = 60D
Const MANICURE_DECIMAL As Decimal = 35D

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
' Exit the program.

Me.Close()
End Sub

Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
' Print the form.

PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()

End Sub

Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
' Clear some fields.

With Me
.TenPerDiscountRadioButton.Checked = True ' Other buttons are false.
.PermanentMakeupRadioButton.Checked = True ' Other buttons are false.
With .QuantityTextBox
.Clear()
.Focus()
End With
End With
End Sub

Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
' Calculate, display totals, amounts, discounts.

Dim QuantityInteger As Integer
Dim PricePerServiceDecimal, TotalPriceDecimal As Decimal



' Find price for choice made.
If PermanentMakeupRadioButton.Checked Then
PricePerServiceDecimal = PERMANENT_MAKEUP_DECIMAL
ElseIf MakeoverRadioButton.Checked Then
PricePerServiceDecimal = MAKEOVER_DECIMAL
ElseIf HairStylingRadioButton.Checked Then
PricePerServiceDecimal = HAIR_STYLING_DECIMAL
ElseIf ManicureRadioButton.Checked Then
PricePerServiceDecimal = MANICURE_DECIMAL
End If


' Calculate price plus total with discounts.
Try
QuantityInteger = Integer.Parse(QuantityTextBox.Text)
TotalPriceDecimal += PricePerServiceDecimal
PricePerServiceDecimal = PricePerServiceDecimal * QuantityInteger - TotalPriceDecimal


If TenPerDiscountRadioButton.Checked Then
PricePerServiceDecimal = QuantityInteger * TEN_PERCENT_DECIMAL
ElseIf TwentPerDiscountRadioButton.Checked Then
PricePerServiceDecimal = QuantityInteger * TWENT_PERCENT_DECIMAL
ElseIf NoDiscountRadioButton.Checked Then
PricePerServiceDecimal = 0
End If
PriceServiceTextBox.Text = PricePerServiceDecimal.ToString("C")
PriceTotalTextBox.Text = TotalPriceDecimal.ToString("C")

' Allow clear after order has started.
Catch QuantityException As FormatException
MessageBox.Show("Quantity must be numeric.", _
"Data Entry Error", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
With QuantityTextBox
.Focus()
.SelectAll()
End With
End Try

End Sub
End Class
Sign In or Register to comment.