0% found this document useful (0 votes)
264 views

Prog 2 Midterm

The document contains code snippets in Visual Basic .NET for payroll processing, conditional logic using If/Else statements, health assessment cost calculation, and case statements. The code handles employee payroll calculation, evaluating text values, selecting output based on radio button and checkbox values, grading scales, and setting output color based on case conditions.

Uploaded by

ehna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
264 views

Prog 2 Midterm

The document contains code snippets in Visual Basic .NET for payroll processing, conditional logic using If/Else statements, health assessment cost calculation, and case statements. The code handles employee payroll calculation, evaluating text values, selecting output based on radio button and checkbox values, grading scales, and setting output color based on case conditions.

Uploaded by

ehna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming 2

Midterm

payroll

Public Class Form1


Private Sub EmployeeInformationToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
EmployeeInformationToolStripMenuItem.Click
forminfo.Show()
End Sub
Private Sub PayrollToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles PayrollToolStripMenuItem.Click
payroll.Show()
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox("record added!" + vbCrLf + "Employee ID:" + txtID.Text + vbCrLf +
"Last Nmae:" + txtln.Text + vbCrLf + "First Name:" + txtfn.Text + vbCrLf + "Middle
Initial:" + txtmi.Text + vbCrLf + "Department:" + txtd.Text)
End Sub
End Class
Public Class payroll
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
txtgross.text = Double.Parse(txtrate.Text) * Double.Parse(txtdp.Text)
txtnet.Text = Double.Parse(txtgross.Text) - Double.Parse(txtDe.Text)
MsgBox("Employee ID:" + txtID.Text + vbCrLf + "Gross:" + txtrate.Text + "x" +
txtdp.Text + "=" + txtgross.Text + vbCrLf + "Net Pay:" + txtnet.Text)
End Sub
End Class

If else

Private Sub tb1_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles textb1.TextChanged
If textb1.Text = "143" Then
lbl1.Text = "i love you!"
Else
lbl1.Text = "i hate you!"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
numbers.Show()

End Sub
End Class
Private Sub textb1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles textb1.TextChanged
If Val(textb1.Text) >= 0 Then
lbl1.Text = "positive number!"
Else
lbl1.Text = "negative number!"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
grades.Show()
End Sub
End Class
Private Sub Textb1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Textb1.TextChanged
If Val(Textb1.Text) >= 90 and val(textb1.Text)<=100 Then
lbl1.Text = "A"
ElseIf Val(Textb1.Text) >= 80 And Val(Textb1.Text) <= 89 Then
lbl1.Text = "B"
ElseIf Val(Textb1.Text) >= 70 And Val(Textb1.Text) <= 79 Then
lbl1.Text = "C"
ElseIf Val(Textb1.Text) >= 60 And Val(Textb1.Text) <= 69 Then
lbl1.Text = "D"
ElseIf Val(Textb1.Text) < 60 Then
lbl1.Text = "F"
Else
lbl1.Text = "invalid entry!"
End If
End Sub
End Class

Health assessment

CT-Scan
Head=12000
Upper Limbs=10000
Lower Limbs=9000
Mouth=5000
X-Ray
Head=600

Upper Limbs=450
Lower Limbs=300
Mouth=150
Physical Exam
Head=300
Upper Limbs=250
Lower Limbs=250
Mouth=200
COMPUTE BUTTON
If rbCT.Checked = True And cbHead.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 12000
End If
If rbCT.Checked = True And cbLow.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 9000
End If
If rbCT.Checked = True And cbUp.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 10000
End If
If rbCT.Checked = True And cbMouth.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 5000
End If
If rbX.Checked = True And cbHead.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 600
End If
If rbX.Checked = True And cbLow.CheckState = 1 Then
txtBill.Text = Val(txtBill.Text) + 300
End If
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
g.Text = Double.Parse(r.Text) * (dp.Text)
If g.Text >= 10000 Then
t.Text = Double.Parse(g.Text) * 0.12
Else
t.Text = Double.Parse(g.Text) * 0.07
End If
If g.Text >= 15000 Then
s.Text = 1750
ElseIf g.Text >= 10000 And g.Text < 15000 Then
s.Text = 1150
ElseIf g.Text >= 5000 And g.Text < 10000 Then

s.Text = 750
Else
s.Text = 350
End If
n.Text = Double.Parse(g.Text) - (Double.Parse(s.Text) + Double.Parse(p.Text) +
Double.Parse(de.Text) + Double.Parse(t.Text))
End Sub
End Class

Case

Dim average As Integer


average = Val(txtave.Text)
Select Case average
Case Is >= 90
txtletter.Text = "A"
Case 80 To 89
txtletter.Text = "B"
Case 70 To 79
txtletter.Text = "C"
Case 60 To 69
txtletter.Text = "D"
Case Is < 60
txtletter.Text = "F"
End Select
txtave.Text = ((Val(txtprelim.Text) + Val(txtmid.Text) + Val(txtfinal.Text)) /
Val(3))
End Sub
Dim color As String
color = txtletter.Text
Select Case color
Case "B", "b"
txtcolor.Text = "BLUE"
txtcolor.ForeColor = Drawing.Color.Blue
Case "R", "r"
txtcolor.Text = "RED"
txtcolor.ForeColor = Drawing.Color.Red
Case "G", "g"
txtcolor.Text = "GREEN"

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy