Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,092 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,808 people online right now. Registration is fast and FREE... Join Now!




Help With Code

 
Reply to this topicStart new topic

Help With Code

muscle
22 Apr, 2008 - 05:51 PM
Post #1

New D.I.C Head
*

Joined: 13 Apr, 2008
Posts: 4

Having a problem with getting this code right. I cant get the names to show up. Don't know how to do listbox, loop, or input box.

This was the problem: create an application that alows a teacher to enter 3 test scores each for three students. The application should calculate each student's average test score an assign a letter grade based on the following grade scale.
[/b]Average Test Score [b]Letter Grade
90 or better A
80 through 89 B
70 through 79 C
60 through 69 D
Below 60 F
The application should prompt the user for each student's name and three test scores. This is an example of how the application's form should appear after all data is entered. Example:
Jennie James: Average: 90.66666 Grade: A
Sammy Smith: Average: 73 Grade: C
Julie Williams: Average: 84.66666 Grade: B

vb
 
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
'Declare varialbes
Dim Score1 As String
Dim Score2 As Double
Dim Score3 As Double
Dim Data As String
Dim Grade As String
'Get input
Score1 = InputBox("Enter Student Name, Student Name")
InputBox("Enter Student Grade, Student Grade")
InputBox("Enter Student Grade Letter, Grade Letter")
lblData.Text = Score1
'Calculate Average
Data = (Score1 Or Score2 Or Score3)
'Display Average
lblData.Text = FormatNumber(Data, 2)
'If score is high, compliment the student
If Data > 95 Then
MessageBox.Show("Congradulations! Great Job!", "Message")
Else
MessageBox.Show("Keep Trying", "Message")
End If

If Data >= 90 Then
Grade = "A"

ElseIf Data >= 80 Then
Grade = "B"

ElseIf Data >= 70 Then
Grade = "C"

ElseIf Data >= 60 Then
Grade = "D"

Else
Grade = "F"
End If

End Sub


This post has been edited by PsychoCoder: 22 Apr, 2008 - 05:52 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:07AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month