JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Help please. Thank you.


L

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam lisa5134
Posts: 1 - Registered: 2011-10-02 07:36:53

I need help. I’m taking a class in Visual Basic (and no I don’t want you to do my homework for me). I don’t understand what is going wrong with my coding (please note I haven’t finished all of the coding because I need to get the first part right first). Here is the topic: (Part 1) 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 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. (Part 2) Allow for sales to additional patrons, include buttons for Next Patron and Summary. When the receptionist clicks the Summary button, display in a summary message box the number of clients and the total dollar value for all services rendered. For Next patron, confirm that the user wants to clear the totals for the current customer.

Once I’m done with part 1, I don’t know how to code part 2. Can some explain this is easy terms please? Thank you.

Here is my code so far:

Public Class Form1

' Declare Constants.

Const PERMANENT_MAKEUP As Decimal = 200D
Const MAKEOVER As Decimal = 125D
Const HAIR_STYLING As Decimal = 60D
Const MANICURE As Decimal = 35D

Const TEN_PERCENT As Decimal = 0.1
Const TWENTY_PERCENT As Decimal = 0.2
Dim TOTAL_DUE As Decimal

'Code for Button Calculate (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
Dim servicePrice As Decimal
Dim PricePerService As Decimal

If MakeoverCheckBox.Checked Then
servicePrice = MAKEOVER
ElseIf HairStylingCheckBox.Checked Then
servicePrice = HAIR_STYLING
ElseIf ManicureCheckBox.Checked Then
servicePrice = MANICURE
ElseIf PermanentMakeupCheckBox.Checked Then
servicePrice = PERMANENT_MAKEUP
End If

If DiscountComboBox.SelectedItem = "None" Then
PricePerService = servicePrice
ElseIf DiscountComboBox.SelectedItem = "10 percent" Then
PricePerService = servicePrice - (servicePrice * TEN_PERCENT)
ElseIf DiscountComboBox.SelectedItem = "20 percent" Then
PricePerService = servicePrice - (servicePrice * TWENTY_PERCENT)

End If
TOTAL_DUE = PricePerService
ServicesMaskedTextBox.Text = PricePerService.ToString("C")
TotalDueMaskedTextBox.Text = TOTAL_DUE.ToString("C")
End Sub

'Code for Button Clear (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
MakeoverCheckBox.Checked = True
DiscountComboBox.SelectedItem = "None"
ServicesMaskedTextBox.Text = String.Empty
TotalDueMaskedTextBox.Text = String.Empty
End Sub

'Code for Button Print (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()

End Sub

'Code for Button Exit (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub

Private Sub HairStylingCheckBox_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles HairStylingCheckBox.CheckedChanged

End Sub
End Class




C

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam ciiure
Posts: 5 - Registered: 2011-11-18 13:45:08

Hi there mate ;D

Ok so the code you wrote did not contain to many mistakes. The only problem with it is the fact that the button event handling lines are different at start and at the end.
Eg.
Private Sub btnCalculate_Click_1(sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click
yours was btnCalculate_Click_1 and at the end Handles ButtonCalculate.

Other thing was when you press Clear it was ticking manicure checkbox but was not doing anything with other checkboxes so if while running you picked permanent makeup it would stay even after pressing clear button.

I fixed your code:


Public Class PermanentMakeup

' Declare Constants.

Const PERMANENT_MAKEUP As Decimal = 200D
Const MAKEOVER As Decimal = 125D
Const HAIR_STYLING As Decimal = 60D
Const MANICURE As Decimal = 35D

Const TEN_PERCENT As Decimal = 0.1
Const TWENTY_PERCENT As Decimal = 0.2
Dim TOTAL_DUE As Decimal


'Code for Button Clear (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
If MakeOverCheckBox.Checked Then
MakeOverCheckBox.Checked = False
ElseIf HairStylingCheckBox.Checked Then
HairStylingCheckBox.Checked = False
ElseIf ManicureCheckBox.Checked Then
ManicureCheckBox.Checked = False
ElseIf PermanentMakeupCheckBox.Checked Then
PermanentMakeupCheckBox.Checked = False
End If
DiscountComboBox.SelectedItem = "None"
ServicesMaskedTextBox.Text = String.Empty
TotalDueMaskedTextBox.Text = String.Empty
End Sub

'Code for Button Print (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()

End Sub

'Code for Button Exit (Double-Click on the Button in Design view to get this Event handler)
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub HairStylingCheckBox_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles HairStylingCheckBox.CheckedChanged

End Sub

Private Shared Function Checked() As Boolean
Throw New NotImplementedException
End Function

Private Sub btnCalculate_Click_1(sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click
Dim servicePrice As Decimal
Dim PricePerService As Decimal

If MakeOverCheckBox.Checked Then
servicePrice = MAKEOVER
ElseIf HairStylingCheckBox.Checked Then
servicePrice = HAIR_STYLING
ElseIf ManicureCheckBox.Checked Then
servicePrice = MANICURE
ElseIf PermanentMakeupCheckBox.Checked Then
servicePrice = PERMANENT_MAKEUP
End If

If DiscountComboBox.SelectedItem = "None" Then
PricePerService = servicePrice
ElseIf DiscountComboBox.SelectedItem = "10 percent" Then
PricePerService = servicePrice - (servicePrice * TEN_PERCENT)
ElseIf DiscountComboBox.SelectedItem = "20 percent" Then
PricePerService = servicePrice - (servicePrice * TWENTY_PERCENT)

End If
TOTAL_DUE = PricePerService
ServicesMaskedTextBox.Text = PricePerService.ToString("C")
TotalDueMaskedTextBox.Text = TOTAL_DUE.ToString("C")
End Sub
End Class


Didnt add the part 2 coding as it is your project ;P
Good luck with it




P

keyboard_arrow_up
0
keyboard_arrow_down


Reply #2 Mark as Spam Pantium48
Posts: 2 - Registered: 2016-04-29 02:00:04

'Project: Ch#04Exercise#01
'Programmer: Radhesham
'Date: 25/04/2016
'Description: Allow the Lynette Rifle an image consulting shop to sell its services.


Public Class LynetteRfileForm


Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

' Declare percent Constants.
Const TEN_PERCENT_DECIMAL As Integer = 10
Const TWENT_PERCENT_DECIMAL As Integer = 20

'Declare service price constants
Const MAKEOVER_DECIMAL As Decimal = 125D
Const HAIR_STYLING_DECIMAL As Decimal = 60D
Const PERMANENT_MAKEUP_DECIMAL As Decimal = 200D
Const MANICURE_DECIMAL As Decimal = 35D

'Declare Bill and payable due variables
Dim decimalTotalBill As Integer
Dim decimalDiscountBill As Decimal


'Checking selected services and calculating their price
If MakeoverCheckBox.Checked Then
decimalTotalBill += MAKEOVER_DECIMAL
End If

If HairStylingCheckBox.Checked Then
decimalTotalBill += HAIR_STYLING_DECIMAL
End If

If PermanentMakeupCheckBox.Checked Then
decimalTotalBill += PERMANENT_MAKEUP_DECIMAL
End If

If ManicureCheckBox.Checked Then
decimalTotalBill += MANICURE_DECIMAL
End If
'Showing actual bill
TotalBillTextBox.Text = decimalTotalBill.ToString("C")

'Calculating 10% discount
If TenPercentDiscountRadioButton.Checked Then
decimalDiscountBill = (decimalTotalBill / 100) * TEN_PERCENT_DECIMAL
decimalTotalBill -= decimalDiscountBill
PayableBillAfterDiscountTextBox.Text = decimalTotalBill.ToString("C")
End If

'Calculating 20% discount
If TwentyPercentDiscountRadioButton.Checked Then
decimalDiscountBill = (decimalTotalBill / 100) * TWENT_PERCENT_DECIMAL
decimalTotalBill -= decimalDiscountBill
PayableBillAfterDiscountTextBox.Text = decimalTotalBill.ToString("C")
End If

End Sub

Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
MakeoverCheckBox.Checked = False
HairStylingCheckBox.Checked = False
PermanentMakeupCheckBox.Checked = False
ManicureCheckBox.Checked = False
TenPercentDiscountRadioButton.Checked = False
TwentyPercentDiscountRadioButton.Checked = False
TotalBillTextBox.Clear()
PayableBillAfterDiscountTextBox.Clear()

End Sub

Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
' Print the form in the Print Preview window.
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub

Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
'Exit the form
Me.Close()
End Sub
End Class







JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising