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!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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 MAKEOVER_DECIMAL As Decimal = 125D
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.

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

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
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
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.
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, _
With QuantityTextBox
End With
End Try

End Sub
End Class
Sign In or Register to comment.