# Hw assignment Help if you can.

Page 1 of 1

## 4 Replies - 966 Views - Last Post: 17 October 2013 - 02:41 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=331623&amp;s=b2a07c5e76215791a113e4bb5f8e9b50&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 bpalafox21993

Reputation: 0
• Posts: 2
• Joined: 15-October 13

# Hw assignment Help if you can.

Posted 15 October 2013 - 01:32 PM

Ok i have the code that asks the user to input 3 numeric values of their grade which ranges from 1-100. then divides those 3 values in order to output the average and grade. Now i need to display all other grades such as A- A+ or an A because the code only displays A B C D F. In addition i have to display the grade point range and grade point value for example an A+ would have a grade point range of 97-100 and a value of 4.000. Do i just modify the ElseIf dblAverage statements in order to finish the final steps. Thoughts ? Here is the code

[/
```public Class Form1

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
' Variables to hold scores and the average score
Dim dblScore1 As Double
Dim dblScore2 As Double
Dim dblScore3 As Double
Dim dblAverage As Double
Const NUM_SCORES As Integer = 3

' Constant for a high score.
Const dblHIGH_SCORE As Double = 95.0
Try
' Copy the TextBox scores into the variables.
dblScore1 = CDbl(txtScore1.Text)
dblScore2 = CDbl(txtScore2.Text)
dblScore3 = CDbl(txtScore3.Text)

' Calculate the average score.
dblAverage = (dblScore1 + dblScore2 +
dblScore3) / NUM_SCORES

' Display the average, rounded to 2 decimal places.
lblAverage.Text = dblAverage.ToString("n2")

If dblAverage < 60 Then
ElseIf dblAverage < 70 Then
ElseIf dblAverage < 80 Then
ElseIf dblAverage < 90 Then
ElseIf dblAverage <= 100 Then
End If

' If the score is high, give the student priase.
' Otherwise, give some encouragement.
If dblAverage > dblHIGH_SCORE Then
Else
lblMessage1.Text = "Keep trying!"
End If
Catch
' Display an error message.
lblMessage1.Text = "Scores must be numeric."
End Try
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
' Clear the TextBoxes and Labels.
txtScore1.Clear()
txtScore2.Clear()
txtScore3.Clear()
lblAverage.Text = String.Empty
lblMessage.Text = String.Empty

' Reset the focus.
txtScore1.Focus()
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
' Close the form.
Me.Close()
End Sub
End Class
]
```

This post has been edited by modi123_1: 15 October 2013 - 01:39 PM
Reason for edit:: please use code tags

Is This A Good Question/Topic? 0

## Replies To: Hw assignment Help if you can.

### #2 modi123_1

• Suitor #2

Reputation: 11606
• Posts: 45,766
• Joined: 12-June 08

## Re: Hw assignment Help if you can.

Posted 15 October 2013 - 03:07 PM

This looks to VB.NET and not java.. moving.

### #3 _ELement_8215

Reputation: 2
• Posts: 34
• Joined: 14-December 11

## Re: Hw assignment Help if you can.

Posted 17 October 2013 - 02:25 PM

I'd say you could do something like this: (but of course applied to all possible grades)

```ElseIf dblAverage <= 100 Then
If dblAverage >=97 AndAlso dblAverage <= 100 Then
'A+
'set the value here of an A+
'ElseIf whatever an A- is
'set the value of an A-
Else
'A
'set the value here of an A
End If
End If

```

This may or may not be the most optimized way to get the assignment done, but it'll give you a jumping off point at least.

This post has been edited by _ELement_8215: 17 October 2013 - 02:26 PM

### #4 andrewsw

• But the opposite, you said.

Reputation: 5523
• Posts: 21,789
• Joined: 12-December 12

## Re: Hw assignment Help if you can.

Posted 17 October 2013 - 02:32 PM

Just to note that:

```If dblAverage >=97 AndAlso dblAverage <= 100 Then
```

you wouldn't need the second part of this condition because the previous line already establishes that the average is <= 100.

### #5 bpalafox21993

Reputation: 0
• Posts: 2
• Joined: 15-October 13

## Re: Hw assignment Help if you can.

Posted 17 October 2013 - 02:41 PM

Thanks guys I figured it out also just need another label and label.txt to display the gpa.