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

Public Class Form1

This code calculates a student's overall average from test, final exam, and attendance scores. It takes user input for test, final, and attendance scores, calculates the average of each category based on weights, sums the averages to get the overall average, and displays it. It also includes buttons to calculate the average, clear the text boxes, and close the form.

Uploaded by

Keith Rivera
Copyright
© Attribution Non-Commercial (BY-NC)
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)
23 views

Public Class Form1

This code calculates a student's overall average from test, final exam, and attendance scores. It takes user input for test, final, and attendance scores, calculates the average of each category based on weights, sums the averages to get the overall average, and displays it. It also includes buttons to calculate the average, clear the text boxes, and close the form.

Uploaded by

Keith Rivera
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim test1 As Decimal
Dim test2 As Decimal
Dim test3 As Decimal
Dim final As Decimal
Dim attendance As Decimal
Dim testaverage As Decimal
Dim finalaverage As Decimal
Dim attendanceaverage As Decimal
Dim overallaverage As Decimal

Decimal.TryParse(Test1TextBox.Text, test1)
Decimal.TryParse(Test2TextBox.Text, test2)
Decimal.TryParse(Test3TextBox.Text, test3)
Decimal.TryParse(FinalTextBox.Text, final)
Decimal.TryParse(AttendanceTextBox.Text, attendance)

testaverage = (test1 + test2 + test3) / 300 * 50


finalaverage = final / 100 * 40
attendanceaverage = attendance / 100 * 10

overallaverage = testaverage + finalaverage + attendanceaverage

FinalAverageLabel.Text = Convert.ToString(overallaverage)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Me.Close()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Test1TextBox.Text = String.Empty
Test2TextBox.Text = String.Empty
Test3TextBox.Text = String.Empty
FinalTextBox.Text = String.Empty
AttendanceTextBox.Text = String.Empty
FinalAverageLabel.Text = String.Empty
End Sub
End Class

You might also like