cis

posted by .

I have to find three errors and ther two logic and syntax error. HELP ME IN IT AND Below is code.




Rem ===========BEGIN SAMPLE CODE============

REM Read 9 scores and report the average
Dim score(10)

For i = 1 to 10
CALL fillArray
PRINT "The average score is "; Sum()/10:
Next j
End


SUB fillArray
count = 0
For i = 1 to 10
READ datum
if datum > 0 then score(i) = datum
if datum = -1 then
exit sub
end if
count = count + 1
PRINT count, datum
Next i

DATA 85, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 84, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 83, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 82, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 81, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 79, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 78, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 77, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 76, 92, 68, 84, 86, 94, 74, 79, 88, -1
DATA 75, 92, 68, 84, 86, 94, 74, 79, 88, -1
END SUB

FUNCTION Sum()
total = 0
FOR i = 1 TO 10
LET total = total + score(i)
NEXT i
Sum = total
END FUNCTION

Rem ===========END SAMPLE CODE============

  • Computer Programming? -

    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.

  • cis -

    Error 1: (logic)
    REM Read 9 scores and report the average
    PRINT "The average score is "; Sum()/10:

    Error 2: (logic)
    Also, for the function Sum(), it should not sum over 10 elements, when only 9 are stored.


    Error 2: (syntax)
    For i = 1 to 10
    CALL fillArray
    PRINT "The average score is "; Sum()/10:
    Next j



    ?Error 3: (logic)
    Check the default type of variables.
    If sum() is integer, then Sum()/10 will lose accuracy because of the integer division.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. child growth development

    Researchers have concluded that A. the proportion of REM sleep to N-REM sleep is similar in infants and adults B. REM sleep provides needed brain stimulation to neonates C. REM sleep is mostly absent in neonates D. the proportion of …
  2. 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) …
  3. computer

    A-Asking the user to pick a number between 1 and 20 and having the computer pick a number between 1 and 20 and telling the user if they won or lost B- For finding the logic error in the program C- For finding and fixing the logic error …
  4. Child Psychology

    Researchers have concluded that A. the proportion of REM sleep to N-REM sleep is similar in infants and adults. B. REM sleep provides needed brain stimulation to neonates. C. REM sleep is mostly absent in neonates. D. the proportion …
  5. physics

    Four light bulbs (A, B, C, D) are connected together in a circuit of unknown arrangement. When each bulb is removed one at a time (and subsequently replaced), the following behavior is observed while it is removed: A B C D A rem * …
  6. Visual Basic

    what does IntTemp and IntRem mean? and whats wrong with my code, i don't know whats wrong with it... Code below: Dim intNum As Integer 'the numderator is read as a whole number. Dim intDenom As Integer 'the denominator is read as a
  7. Math

    each "word" in a special code is a three digit number. if no word in the code can begin with a 1 or 0, what is the greatest number of different words the code can contain?
  8. Computer Literary

    Which of the following is Not an example of debugging A)Looking for errors in programming code B)Fixing misspelled commands in programming code C)Solving faulty logic in programming code D)Upgrading to improve the programming code
  9. Chemistry

    A Se-75 source is producing 310 rem at a distance of 3.0 m. What is the distance needed to decrease the intensity of exposure to below 25 rem, the level at which no effects would be detectable.
  10. computer science

    Write a java program that reads from the user the course code, section and the scores of a student for three exams representing two midterms and a final. The percentage of each of the three exams is of fixed value 30, 30 and 40 percent …

More Similar Questions