Below is an assignment that i did but i didnt do good on it. It is/was never meant to be ran the teacher was just asking for the code to be written based off of her A-D. Can you please let me know what is right and wrong with this.

This is using VBScript

The parts of this ? are all continuations of each other. U may assume
code written for the later portions of the ? uses the results of the previous
parts of the ?.

A. Write a line of code to create an array called aScores that will have 10 values.

Dim aScores(9)

B. Set up a loop that will allow the user to enter 10 values into consecutive
locations in the array aScores.

ReDim aScores(iCount)

For t = 1 to 10 vInput = InputBox("Enter Score: " & cstr(t), "Question: " & cstr(t)) If isNumeric(vInput) Then
aScores(t) = cInt(vInput)
Else
aScores(t) = 0
End If

C. Assume that a variable named ScoreAverage exists and has been assigned the
value of 0 (zero). Set up a loop and any additional statements necessary to
calculate the average of the values in aScores. The average should be assigned to
ScoreAverage.

ScoreAverage = 0

ScoreAverage = ScoreAverage + aScores(t)

Next ScoreAverage = cint(ScoreAverage/10)

D. Assume that a variable called HighCount exists and has been assigned the value of
0 (zero). Set up a loop to count the number of values in the array that exceed the
average. That number should be assigned to HighCount.


HighCount = 0

For t = 1 to iCount ScoreAverage = ScoreAverage + aScores(t)

If aScores(q) > iAvg Then
ScoreAverage = ScoreAverage + 1
End If

Edited 5 Years Ago by davewillis: forgot code references

Deleted original post.

Edited 5 Years Ago by Unhnd_Exception: n/a

This article has been dead for over six months. Start a new discussion instead.