English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Can someone tell me how to write the following program in Microsoft Visual Basics. My interface looks great but Im going to get an F unless I come up with the correct codes.
Please no smart *** answers. I am a full time student and I work a full time and part time job to take care of me and my family. I hate programming. I dont need anyone making remarks about me not reading or doing my work, This is serious business. Can someone just help me out please.

I have to Design an application that will accept students numerical score and return a letter grade. Please help me.

2006-10-08 15:41:20 · 3 answers · asked by DuceDuce 2 in Computers & Internet Programming & Design

3 answers

It's not so easy that I can tell you the code based on your info.

I'll try helping some tho.

You need a text box for input, a button and a label for output.

It's kinda simple now that I think of it. You have the command button take the value from the text box assign it to a variable. prolly an integer. so call it int_grade or w/e

then take int_grade and run it through and if that say if >89 then label = A else if >79 then label = B else if >69 then label = C else if > 59 then label = D Else then label = F

you could make it more complicated with +/- system. you could do that with a different if where you check only the ones or something.

kinda rudimentary its been awhile since i did VB and I don't know exactly what you desire but that could be the foundation of what you need.

2006-10-08 15:53:46 · answer #1 · answered by Anonymous · 0 0

I'm going to assume you're using VB 2005, and that you do not need to store any other information other than a single grade, and return a single character value that is the person's grade.

From your toolbox, drag a button, a text box, and a label onto your form.

Name the button: btnGetGrade
Name the text box: txtboxGradeInput
Name the label: lblDisplayGrade
You can also add a descriptive label that prompts for the input if need be.

So here's what it should look like:
__________ ______
Input student's grade: |__txtbox___| |__btn__|
Label

Now, double click on the button (btnGetGrade)
And type in the below:

Private Sub btnGetGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetGrade.Click
Dim studentScore As Integer = CInt(Me.txtboxGrade.Text)

If studentScore > 90 Then
Me.lblDisplayGrade.Text = "Student Grade Letter: A"
Else
If studentScore > 80 Then
Me.lblDisplayGrade.Text = "Student Grade Letter: B"
Else
If studentScore > 70 Then
Me.lblDisplayGrade.Text = "Student Grade Letter: C"
Else
If studentScore > 60 Then
Me.lblDisplayGrade.Text = "Student Grade Letter: D"
Else
Me.lblDisplayGrade.Text = "Student Grade Letter: F"
End If
End If
End If
End If
End Sub

2006-10-08 23:34:48 · answer #2 · answered by addtheninth 2 · 0 0

Why not cut and paste your code that you've worked so hard on so far and maybe we'll help.

2006-10-08 22:42:57 · answer #3 · answered by Mitch B 2 · 0 0

fedest.com, questions and answers