Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

‘Author Ahmad Termizi Bin Muhammad 2021232361

Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Button

Public Class Form1

Dim StudentID, StudentNo, StudentName, StudentAddress, EnrolledProgramme As


String
Dim total As Double
Dim Club, Course As String

Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles


btnReset.Click
reset()
End Sub
Sub Reset()
Me.Controls.Clear()
InitializeComponent()

End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles


btnExit.Click
exitprogram()
End Sub
Sub exitprogram()
Me.Close()
InitializeComponent()
End Sub

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles


btnCalculate.Click
If StuId.Text = "" And StuName.Text = "" And StuNo.Text = "" And StuAdd.Text
= "" And StuPro.Text = "" Then
MessageBox.Show("Please make sure to fill all information before
proceed. ", "Student Information")
Else
StudentID = StuId.Text
StudentName = StuName.Text
StudentNo = StuNo.Text
StudentAddress = StuAdd.Text
EnrolledProgramme = StuPro.Text

total = FormatCurrency(CalculateTotal)
studentRegSlip()

End If
End Sub

Function CalculateTotal() As Integer


Dim overalltotal As Integer
overalltotal = CourseSelection() + ClubSelection()

Return overalltotal
End Function
Function CourseSelection() As Double
Dim fees As Double = 0
Course = " "

If CrsAPS.Checked Then
fees += 230
Course += "Applied Problem Solving "
End If

If CrsMii.Checked Then
fees += 350
Course += "Mathematics II "
End If

If CrsCA.Checked Then
fees += 400
Course += "Computer Architecture "
End If

If CrsSD.Checked Then
fees += 400
Course += "Software Development "
End If

If CrsWP.Checked Then
fees += 250
Course += "Web Programming "
End If

If CrsFYP.Checked Then
fees += 600
Course += "Final Year Project "
End If

Return fees

End Function
Function ClubSelection() As Integer
Dim fees As Integer = 0
Club = " "

If ClbGame.Checked Then
fees += 500
Club += "E-Sport "
End If

If ClbTaek.Checked Then
fees += 50
Club += "Taekwondo "
End If

If ClbBasket.Checked Then
fees += 20
Club += "Basketball "
End If

If ClbBad.Checked Then
fees += 15
Club += "Badminton "
End If
If ClbToast.Checked Then
fees += 40
Club += "Toastmaster "
End If

If ClbDance.Checked Then
fees += 35
Club += "Dance "
End If

Return fees

End Function
Sub studentRegSlip()
RegSlip.Text = ""

RegSlip.Text = " Here is your student registration slip" & vbCrLf &

"*******************************************************************************" &
vbCrLf &
vbCrLf &
"Student ID : " & StudentID & vbCrLf &
"Student Name : " & StudentName & vbCrLf &
"Student Phone No : " & StudentNo & vbCrLf &
"Student Address : " & StudentAddress & vbCrLf &
"Course Enrolled : " & EnrolledProgramme & vbCrLf & vbCrLf &
"Course : " & Course & vbCrLf &
"Club : " & Club & vbCrLf &
"Total : " & FormatCurrency(total, 2)
totalPay.Text = FormatCurrency(total, 2)

End Sub

End Class

You might also like