Create a new project to report name of students receiving an \"A\" (>=90), B (<9
ID: 3528075 • Letter: C
Question
Create a new project to report name of students receiving an "A" (>=90), B (<90, >80), and C (<80, >=70) in science with one click of a button. I am given a text file that displays the following data. Name, English, Math, Science, Social Studies Adam, 75, 80, 90, 63 Betty, 90, 76, 78, 88 Chris, 95, 82, 83, 92 Duane, 80, 90, 94, 72 Elena, 98, 92, 88, 86 Fried, 80, 90, 95, 75 George, 63, 72, 85, 76 Hilary, 82, 86, 76, 88 Iris, 80, 85, 95, 80 Jeff, 86, 98, 94, 90 I am not very familiar with arrays, and am having a lot of trouble with this problem. This is what I have so far. When the grades are displayed it should say "'A' students in Science:" Then list them. The same for B and C. I can get the text file loaded okay, and was able to get all the A's to display but when I tried to add on the B's and C's it got complicated. Private Sub btnBrowse_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse.Click Dim dlgFile As New OpenFileDialog dlgFile.Title = "Please select a student file" dlgFile.Filter = "Text File *.txt|*.txt|Adope PDF *.pdf|*.pdf" dlgFile.ShowDialog() txtFile.Text = dlgFile.FileName dlgFile.Dispose() LoadData() End Sub Private Sub LoadData() End Sub Private Sub btnGrades_Click(sender As System.Object, e As System.EventArgs) Handles btnGrades.Click If txtFile.Text = "" Then Return If Not IO.File.Exists(txtFile.Text) Then Return Dim alllines() = IO.File.ReadAllLines(txtFile.Text) Dim data() As String Dim Aname(), Bname(), Cname() As String Dim Agrade(), Bgrade(), Cgrade() As Integer Dim Acount As Integer = 0 Dim Bcount As Integer = 0 Dim Ccount As Integer = 0 lstboxGrades.Items.Clear() For i As Integer = 1 To alllines.Length - 1 data = alllines(i).Split(","c) Next If CInt(data(3)) >= 90 Then ReDim Preserve Aname(Acount) ReDim Preserve Agrade(Acount) Aname(Acount) = data(0) Agrade(Acount) = data(3) Acount += 1 For i As Integer = 0 To Acount - 1 lstboxGrades.Items.Add(Aname(i) & ": " & Agrade(i)) Next ElseIf CInt(data(3)) >= 80 Then ReDim Preserve Bname(Bcount) ReDim Preserve Bgrade(Bcount) Bname(Bcount) = data(0) Bgrade(Bcount) = data(3) Bcount += 1 For i As Integer = 0 To Bcount - 1 lstboxGrades.Items.Add(Bname(i) & ": " & Bgrade(i)) Next ElseIf CInt(data(3)) >= 70 Then ReDim Preserve Cname(Ccount) ReDim Preserve Cgrade(Ccount) Cname(Ccount) = data(0) Cgrade(Ccount) = data(3) Ccount += 1 For i As Integer = 0 To Ccount - 1 lstboxGrades.Items.Add(Cname(i) & ": " & Cgrade(i)) Next End If End SubExplanation / Answer
The variables for the grades are a, b, c, d, e respectivly and the subject code variable is Subj. The origional mark is orig and the new mark is remark. Code: Open "c:/windows/desktop/v.b/students.dat" For Input As #1 Input #1, first, last, cndnum, cntselnum, cntsel, subsel, orig, recdate, duedate, request 'inputs values into the combo boxes from IF criteria If cmbcen.Text = cntselnum And cmbcndnum.Text = cndnum And cmbpaper.Text = subsel Then lblfirst.Caption = first lbllast.Caption = last lblcndnum.Caption = cndnum lblcntnum.Caption = cntselnum lblsubcode.Caption = subsel lblorig.Caption = orig lbldate.Caption = duedate End If If request = 1 Then rdoyes.Value = True And rdono.Enabled = False End If If request = 0 Then rdono.Value = True And rdono.Enabled = False End If Close #1 'assigns relative grade to value of orig Open "c:windowsdesktopv.bcodes.dat" For Input As #1 Do While lblsubcode.Caption = subj Input #1, subj, a, b, c, d, e If orig >= a Then lblograd.Caption = "A" ElseIf orig >= b = c = d = eRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.