The first character is a letter department on which department the employee work
ID: 3639044 • Letter: T
Question
The first character is a letter department on which department the employee works in Accounting has code letter A Marketing has code letter B Research has code letter C Public Relations has code letter D sales has code letter E Human Resources has code letter F The next two characters are numbers generated by adding 10 to the employee birth The next characters are numbers generated by adding 10 to the number of letters in the employee's last name. Note: You should use an if block for the entire program. (No select Case Blocks) you may need to use the trim function when displaying Change input to uppercase. Dealing with invalid data:Explanation / Answer
Public Class Form1
Private Sub btnEmployee_Click(sender As System.Object, e As System.EventArgs) Handles btnEmployee.Click
Dim department As Char
Dim month As Integer = 0
Dim name As Integer = 0
name = txtLast.Text.Length + 10
If txtDepartment.Text.ToUpper = "ACCOUNTING" Then
department = CChar("A")
ElseIf txtDepartment.Text.ToUpper = "MARKETING" Then
department = CChar("B")
ElseIf txtDepartment.Text.ToUpper = "RESEARCH" Then
department = CChar("C")
ElseIf txtDepartment.Text.ToUpper = "PUBLIC RELATIONS" Then
department = CChar("D")
ElseIf txtDepartment.Text.ToUpper = "SALES" Then
department = CChar("E")
ElseIf txtDepartment.Text.ToUpper = "HUMAN RESOURCES" Then
department = CChar("F")
End If
If txtMonth.Text.ToUpper = "JANUARY" Then
month = 1 + 10
ElseIf txtMonth.Text.ToUpper = "FEBRUARY" Then
month = 2 + 10
ElseIf txtMonth.Text.ToUpper = "MARCH" Then
month = 3 + 10
ElseIf txtMonth.Text.ToUpper = "APRIL" Then
month = 4 + 10
ElseIf txtMonth.Text.ToUpper = "MAY" Then
month = 5 + 10
ElseIf txtMonth.Text.ToUpper = "JUNE" Then
month = 6 + 10
ElseIf txtMonth.Text.ToUpper = "JULY" Then
month = 7 + 10
ElseIf txtMonth.Text.ToUpper = "AUGUST" Then
month = 8 + 10
ElseIf txtMonth.Text.ToUpper = "SEPTEMBER" Then
month = 9 + 10
ElseIf txtMonth.Text.ToUpper = "OCTOBER" Then
month = 10 + 10
ElseIf txtMonth.Text.ToUpper = "NOVEMBER" Then
month = 11 + 10
ElseIf txtMonth.Text.ToUpper = "DECEMBER" Then
month = 12 + 10
End If
txtIDnum.Text = department & month & name
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.