lance7tour
-
Total Posts
:
9
- Scores: 0
-
Reward points
:
0
- Joined: 1/31/2011
-
Status: offline
|
Is this correct? VBScript
Thursday, March 31, 2011 2:58 AM
( permalink)
Is this correct 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 strScores = strScores & cstr(aScores(t)) & ", " ' String scores together
|
|
|
|
angryrabbit
-
Total Posts
:
36
- Scores: 2
-
Reward points
:
0
- Joined: 11/23/2010
-
Status: offline
|
Re:Is this correct? VBScript
Friday, April 01, 2011 4:21 AM
( permalink)
You don't have to ask us if it's correct. Run it and you will know if it's correct.
|
|
|
|
lance7tour
-
Total Posts
:
9
- Scores: 0
-
Reward points
:
0
- Joined: 1/31/2011
-
Status: offline
|
Re:Is this correct? VBScript
Friday, April 01, 2011 10:10 AM
( permalink)
I understand that but A-D represent an assignment that I did not do good on and all I got out of it was minus this minus that. Nothing about what needed to be done to make it right.
|
|
|
|