Post a New Question

VBScript

posted by .

Option Explicit
Dim Answer
Dim aScores()
Dim intNumScores

' Initialize Answer so loop will enter and execute
Answer = vbOK
Do While Answer = vbOK

intNumScores = CInt(InputBox("How many scores will you be entering?", "Enter

Number Of Scores"))

ReDim aScores(intNumScores)
Dim ii
Dim sngSum
Dim Score

' Initialize the sum to 0
sngSum = 0
For ii = 0 To intNumScores -1
Score = InputBox("Enter Score #" & ii + 1, "Enter Score")
' If user just hit enter, exit.
If Score = "" Then
Exit For
End If

' Store value in array
aScores(ii) = CSng(Score)

' Add new value to the running sum
sngSum = sngSum + aScores(ii)
Next

' If user entered a blank, exit
If Score = "" Then
Exit Do
End If

' Compute Average
Dim sngAvg
sngAvg = sngSum / intNumScores


Answer = MsgBox("The Average Score is: " & sngAvg & " Continue?", 65,

"Average")

Loop

Please can you check for me?

  • Computer programming -

    Assistance needed.

    Please type your subject in the School Subject box. Any other words, including obscure abbreviations, are likely to delay responses from a teacher who knows that subject well.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. visual basic

    Cant get my message dialog box to display anbody see waht wrong with it?
  2. visual basic

    here is my source code for my program im trying to convert 10 units from furlong to meters the answer is supposed to be 2011.68 meters i keep getting 2000. I know if i cant get this right the rest of the conversion will give the wrong …
  3. programming

    I am supposed to modify this program so it begins by asking the user for the number of values. The program then uses a loop to read the specified number of values and then display their average. program is below that i worked on in …
  4. visual basic

    Im trying to get this program to average three number having a problem the sample nmubers im using are 6 6 2 average supposed to be 4.6667 but im just geting .6667 I think it has something to do with my s=value(i) not sure what i need …
  5. Computer programming

    The code below is supposed to calculate the average for a student using 10 grades. It contains several errors. Rewrite the code using the correct naming conventions and turn in the full solution and discuss using this topic. Dim arrGrades(10) …
  6. comptuer programming

    i need help with my code i keep comin up with errors in basic Dim Firstname as string Dim Lastname as string Dim Empnum As Integer Dim HourRate As Integer Dim Hours As Integer Dim Tools As Integer Dim Total As Integer Dim Netpay As …
  7. VBA programming

    How to get isnumeric function to display an "error" message when necessary. Sub DetermineinterestSelectCase() Dim loan As Variant Dim interest As Double loan = InputBox("Enter your desired loan amount, from 1 dollar to 5 million dollars.") …
  8. VBA Programming

    I'm trying to create a macro that asks for a loan between 1 dollar and 5 million, and returns different interest rates based on the amount of the loan. For some reason when I type in different loan amounts it automatically makes my …
  9. Computer Programming

    I'm trying to create a vba code that solves this problem: 50 apartment units rent for 600 a month, for each 40 dollar increase in rent a unit becomes unoccupied. I want to find the max profit and number of units at that number. Sub …
  10. Visual Basic

    how to use formula b=p (1+r)^n, to calculate annual interests for a savings account in visual basic project This is my code so far>>>>>>>>>>>>>> Option Explicit On Option Strict On Option Infer …

More Similar Questions

Post a New Question