Hi! I'm new here but I am in serious need of help. I have a program that I am trying to write but I just can't get all of the pieces together. The book I'm using isn't very good either. Could you guys take a look and help me write the code? I would appreciate it!
Here are the assignment intructions and below this is what I currently have. It's not much:o
Create a Visual Basic program that creates a bill for an automobile repair shop. The shop bills customers at the rate of $35 per hour for labor. Parts and supplies are subject to a 5% sales tax. The customers name, the number of hours of labor, and the cost of parts and supplies should be entered into the program via textboxes. When the Display Bill button is clicked, the customers name and the 3 costs should be displayed in a list box as shown below.
1. Name your application Assignment_2.
2. Name the form frmAssignment_2. The title should be as depicted below.
3. Name the labels lblCustomer, lblPhone, lblHours, and lblParts.
4. Name the textboxes txtCustomer, txtHours, and txtParts.
5. Name the listbox lstBill.
6. The Customer phone textbox should be a MaskedTextBox and should allow inputs only in the form of ___-____ (3 characters, followed by a dash, followed by 4 characters). Name this MaskedTextBox mtbPhone. Show the underlines and dash in the mask.
7. tAdd the access keys as displayed in the diagram below.
8. If the user leaves the Customer, Hours, or Parts textboxes blank, produce an error message (using a MessageBox) that informs the user to enter the appropriate information and do not display the information in the listbox.
9. Create variables to hold the customer, phone, hours, and parts information. Name the variables customer, phone, hours, and parts. Their data types should be string, string, double, and double, respectively.
10. When the user clicks the Display Bill button, prompt the user to enter in the date of the services. Store this information in a variable called service_date. Display this date and the date the invoice is due (30 days from the date entered) in the listbox as shown below. [Hint: use the AddDays function]. Store the due date in a variable called due_date.
11. Convert the customer name variable to upper case before displaying it in the listbox.
12. Whenever the user clicks the Display Bill button, the listbox should be cleared before displaying the new results.
13. To calculate the amounts, create three variables (labor_cost, parts_cost, and total_cost), and display these amounts in the listbox as shown below.
14. Be sure to use currency format where appropriate.
15. Be sure that the columns line up appropriately. [Hint: you can use the built-in Visual Basic constant vbTab to create neat columns in your listbox.]
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblHours.Click
End Sub
Private Sub btnBill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBill.Click
Dim prompt, title As String
Dim service_date As Date = CDate(firstBill.Text)
prompt = "Enter date of services"
title = "Date of Services"
service_date = InputBox(prompt, title)
service_date.AddDays(30)
If txtCustomer.Text Is DBNull.Value OrElse txtCustomer.Text.Trim() = "" Then
MessageBox.Show("Please enter your name")
End If
If txtHours.Text Is DBNull.Value OrElse txtHours.Text.Trim() = "" Then
MessageBox.Show("Please enter hours of labor")
End If
If txtParts.Text Is DBNull.Value OrElse txtParts.Text.Trim() = "" Then
MessageBox.Show("Please enter the parts and supplies used")
End If
If mtbPhone.Text Is DBNull.Value OrElse mtbPhone.Text.Trim() = "" Then
MessageBox.Show("Please enter your phone number")
End If
End Sub
Private Sub txtCustomer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustomer.TextChanged
Dim Customer As String = "John Doe"
End Sub
Private Sub mtbPhone_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles mtbPhone.MaskInputRejected
Dim Phone As String = "555 - 555"
End Sub
Private Sub txtHours_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHours.TextChanged
Dim Hours As Double = "12"
End Sub
Private Sub txtParts_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParts.TextChanged
Dim Parts As Double = "150"
End
End Sub
Private Sub firstBill_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles firstBill.SelectedIndexChanged
End Sub
End Class
Here are the assignment intructions and below this is what I currently have. It's not much:o
Create a Visual Basic program that creates a bill for an automobile repair shop. The shop bills customers at the rate of $35 per hour for labor. Parts and supplies are subject to a 5% sales tax. The customers name, the number of hours of labor, and the cost of parts and supplies should be entered into the program via textboxes. When the Display Bill button is clicked, the customers name and the 3 costs should be displayed in a list box as shown below.
1. Name your application Assignment_2.
2. Name the form frmAssignment_2. The title should be as depicted below.
3. Name the labels lblCustomer, lblPhone, lblHours, and lblParts.
4. Name the textboxes txtCustomer, txtHours, and txtParts.
5. Name the listbox lstBill.
6. The Customer phone textbox should be a MaskedTextBox and should allow inputs only in the form of ___-____ (3 characters, followed by a dash, followed by 4 characters). Name this MaskedTextBox mtbPhone. Show the underlines and dash in the mask.
7. tAdd the access keys as displayed in the diagram below.
8. If the user leaves the Customer, Hours, or Parts textboxes blank, produce an error message (using a MessageBox) that informs the user to enter the appropriate information and do not display the information in the listbox.
9. Create variables to hold the customer, phone, hours, and parts information. Name the variables customer, phone, hours, and parts. Their data types should be string, string, double, and double, respectively.
10. When the user clicks the Display Bill button, prompt the user to enter in the date of the services. Store this information in a variable called service_date. Display this date and the date the invoice is due (30 days from the date entered) in the listbox as shown below. [Hint: use the AddDays function]. Store the due date in a variable called due_date.
11. Convert the customer name variable to upper case before displaying it in the listbox.
12. Whenever the user clicks the Display Bill button, the listbox should be cleared before displaying the new results.
13. To calculate the amounts, create three variables (labor_cost, parts_cost, and total_cost), and display these amounts in the listbox as shown below.
14. Be sure to use currency format where appropriate.
15. Be sure that the columns line up appropriately. [Hint: you can use the built-in Visual Basic constant vbTab to create neat columns in your listbox.]
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblHours.Click
End Sub
Private Sub btnBill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBill.Click
Dim prompt, title As String
Dim service_date As Date = CDate(firstBill.Text)
prompt = "Enter date of services"
title = "Date of Services"
service_date = InputBox(prompt, title)
service_date.AddDays(30)
If txtCustomer.Text Is DBNull.Value OrElse txtCustomer.Text.Trim() = "" Then
MessageBox.Show("Please enter your name")
End If
If txtHours.Text Is DBNull.Value OrElse txtHours.Text.Trim() = "" Then
MessageBox.Show("Please enter hours of labor")
End If
If txtParts.Text Is DBNull.Value OrElse txtParts.Text.Trim() = "" Then
MessageBox.Show("Please enter the parts and supplies used")
End If
If mtbPhone.Text Is DBNull.Value OrElse mtbPhone.Text.Trim() = "" Then
MessageBox.Show("Please enter your phone number")
End If
End Sub
Private Sub txtCustomer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustomer.TextChanged
Dim Customer As String = "John Doe"
End Sub
Private Sub mtbPhone_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles mtbPhone.MaskInputRejected
Dim Phone As String = "555 - 555"
End Sub
Private Sub txtHours_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHours.TextChanged
Dim Hours As Double = "12"
End Sub
Private Sub txtParts_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParts.TextChanged
Dim Parts As Double = "150"
End
End Sub
Private Sub firstBill_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles firstBill.SelectedIndexChanged
End Sub
End Class