Skip to document

Sample Q4 Solution programming 1a assignmnent

Question Sample for Q4 Solution program 1A assignment
Course

Programming

119 Documents
Students shared 119 documents in this course
University

Damelin

Academic year: 2020/2021
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
Damelin

Comments

Please sign in or register to post comments.

Related Studylists

programmingStudy _IT

Preview text

Public Class Form Dim count As Integer = 0 Dim Marks(3) As Integer

'function that find the highest marks from the give three marks Function FindHighestMark(ByVal m_1 As Integer, ByVal m_2 As Integer, ByVal m_3 As Integer) If m_1 > m_2 Then If m_1 > m_3 Then Return m_ Else Return m_ End If

ElseIf m_2 > m_3 Then Return m_ Else Return m_ End If End Function

'function that calculate average marks start here Function CalcAverage(ByVal m_1 As Integer, ByVal m_2 As Integer, ByVal m_3 As Integer) Return (m_1 + m_2 + m_3) / 3 End Function

'funtion that categorises the marks Function Category(ByVal m As Integer) If m >= 75 Then Return "Passed with Distinction"

ElseIf m >= 50 Then Return "Passed" ElseIf m >= 40 Then Return "Suplementary" Else Return "Failed" End If End Function

'the method to display all the results on the list box Sub Display(ByVal aver As Integer, ByVal HighestM As Integer) lstDisplay.Items() lstDisplay.Items("Individual Assignment Mark: " + Marks(0).ToString() + " " + Category(Marks(0))) lstDisplay.Items("Test Mark: " + Marks(1).ToString() + " " + Category(Marks(1))) lstDisplay.Items("Group Assignment Mark: " + Marks(2).ToString() + " " + Category(Marks(2))) lstDisplay.Items("The highest Marks is: " + HighestM()) lstDisplay.Items("Average Marks is: " + aver()) End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnClose Me() End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles btnNextMark 'decleare and initialize an integer value to the variable. Dim m As Integer = Convert(tbxMarks)

If m >= 0 And m <= 100 Then If count = 0 Then

Dim highestMark As Integer average = CalcAverage(Marks(0), Marks(1), Marks(2)) highestMark = FindHighestMark(Marks(0), Marks(1), Marks(2)) Display(average, highestMark) End Sub End Class

Was this document helpful?

Sample Q4 Solution programming 1a assignmnent

Course: Programming

119 Documents
Students shared 119 documents in this course

University: Damelin

Was this document helpful?
Public Class Form1
Dim count As Integer = 0
Dim Marks(3) As Integer
'function that find the highest marks from the give three marks
Function FindHighestMark(ByVal m_1 As Integer, ByVal m_2 As Integer, ByVal m_3 As Integer)
If m_1 > m_2 Then
If m_1 > m_3 Then
Return m_1
Else
Return m_3
End If
ElseIf m_2 > m_3 Then
Return m_2
Else
Return m_3
End If
End Function
'function that calculate average marks start here
Function CalcAverage(ByVal m_1 As Integer, ByVal m_2 As Integer, ByVal m_3 As Integer)
Return (m_1 + m_2 + m_3) / 3
End Function
'funtion that categorises the marks
Function Category(ByVal m As Integer)
If m >= 75 Then
Return "Passed with Distinction"