Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need Homework Help Please Posted by jqp on 4 Feb 2011 at 7:35 PM
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 it.like 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.

GRADE BOOK
'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.

Report
Re: Need Homework Help Please Posted by pseudocoder on 6 Feb 2011 at 8:36 PM
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

HTH



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.