hey, guys, was wondering if i could get some help with this school assingmnet. no, im not asking for code. more like guidance and clarification. the following is the assignment itself:
You are required to create a Visual Basic application for the Roytec Examinations Department. The program must accept student exam results marked out of 100 via an input box until the value entered is “END”. These values must range between zero (0) and one hundred (100) and must be stored in an array. Invalid values entered must be flagged by a message box which states “Values must be between 0 and 100”. The maximum number of students in any class is 25. (40 marks)
While values are being stored in the array the program must keep track of the number of scores in the
(1) “A” range (90-100)
(2) “B” range (80-89)
(3) “C” range (70-79)
(4) “D” range (60-69)
(5) “F” range (below 60)
Also, the highest score, lowest score, the average (mean) score, the percentage of the grades that fall above the average and the number of invalid entries must be calculated and displayed in the GUI.
a) You must use a Do loop count the number of grades.
b) You must use a case statement to count how many grades are in each range.
c) The number of grades should be stored as a variable and used in the calculation of the average
You are also required to document:
a) Snippets of pseudocode for
i) The validation check.
ii) Storing the values in the array.
iii) Counting the number of invalid entries, and total number of entries.
iv) Counting number of scores in each range.
v) Calculating the highest, lowest, average score and percentage above average (25)
and here is my code
Public Class Form1 Private Sub startButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startButton.Click Dim grades(25) As Integer Dim grade As Integer Dim grad As Integer Dim aCount As Integer = 0 Dim bCount As Integer = 0 Dim cCount As Integer = 0 Dim dCount As Integer = 0 Dim fCount As Integer = 0 Dim highest As Integer Dim lowest As Integer = 999 For i As Integer = 0 To 5 grade = InputBox("Values must be between 0 and 100 ", "Please enter student grades:") Integer.TryParse(grade, grad) grades(i) = grad Dim invalidcount As Integer = 0 If grad < 0 Or grad > 100 Then MsgBox("Values must be between 0 and 100") invalidcount = invalidcount + 1 End If If grad >= 90 Or grad = 100 Then aCount = aCount + 1 End If If grad >= 89 Or grad = 80 Then bCount = bCount + 1 End If If grad >= 79 Or grad = 70 Then cCount = cCount + 1 End If If grad >= 69 Or grad = 60 Then dCount = dCount + 1 End If If grad < 60 And grad > 0 Then fCount = fCount + 1 End If If grad > highest And grad <= 100 Then highest = grad ElseIf grad < lowest And grad >= 0 Then lowest = grad End If invalidTextBox.Text = invalidcount.ToString Next highestTextBox.Text = highest.ToString lowestTextBox.Text = lowest.ToString outputLabel.Text = aCount.ToString & "students made As, " & bCount.ToString & " made Bs, " & cCount.ToString & "made Cs, " & dCount.ToString & "made Ds' " & fCount.ToString & "made Fs" End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() End Sub Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click invalidTextBox.Text = String.Empty lowestTextBox.Text = String.Empty highestTextBox.Text = String.Empty End Sub End Class
the problems im having : my counter for the number of invalid entries does not work. it incriments once and thats it.
im not sure how to impliment do...while loops into an array as sir never covered that with us
not completely sure on how to take out the marks stores to find a percentage for above average, nor am i sure on how to check for the mean.
attached is my gui.
any help or input would be a ppreciated. while waiting on a reply i will continue my search for solutions to my probelms online.
thanks in advance.