Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need Homework Help Please

jqpjqp Member Posts: 1
hey i was wondering if anyone could please help me out with this problem i will post it below i am kinda having a hard time understanding could anyone kinda just get me started on this i just need some example or something to just start on i am so visual so i have a hard time just imagining this.

'suppose a teacher has five students who have taken four test. the teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores.

test scores: letter grade:
90-100 A
80-89 B
70-79 C
60-69 D
0-59 E
Equip the application with a menu or a set of buttons that allow the application to perform the following.
-display a form that allows the user to enter or change the student names and their test score.
-calculate and display each students average test score and a letter grade based on the average.

All im looking for is a way to start this we have been working with arrays and doing loops so i just need a little push into how to start my program.

Thanks a lot any help will be appreciated.


  • pseudocoderpseudocoder Member Posts: 697 ✭✭✭
    In general, you can declare a UDT and make an array out if it. I don't know which version of VB you have, and I don't have access to any versions other than VB6 but hopefully it will help you out some.

    Private Type Student
    Grades(0 to 3) as Integer
    Name as String
    LetterGrade as String
    ' other parameters if needed
    End Type

    Dim students(0 to 4) as Student

    As far as the menu goes, you'd have to check your version to see how to show/hide forms. I know newer versions vary wildly from what I'm familiar with.

    For the user interface, an idea may be to use a listbox with each of the 5 students listed. Once the user clicks on a student, you can use that event to prompt for grades... the "index" within the listbox would give you the selected student.

    To calculate the grades, loop through the students and each of their grades.

    For i = 0 to 4 ' the students
    sum = 0
    For j = 0 to 3 ' the grades
    sum = sum + students(i).Grades(j)
    Next j
    avg = sum / 4
    If avg >= 90
    students(i).LetterGrade = "A"
    ElseIf avg >= 80
    students(i).LetterGrade = "B"
    Next i

    Perhaps something along those lines. HTH

Sign In or Register to comment.