0

I need help writing this pseudocode please!!
Write the pseudocode for an application which loads a one dimensional floating point array named tests with 25 test scores from a file. Use the tests array to calculate and print the average of the 25 test scores for a class of students.
Thank you!

2
Contributors
2
Replies
24
Views
4 Years
Discussion Span
Last Post by DavidB
0

This is what i got so far:

int SIZE = 25;
     int [ ] scores = new int [ SIZE];
     for (int I = 0; I < scores.length; I++)
         scores [ I ] = I * I;
         average= sum/length;
     print average
1

A few things come to mind:

1) you already know the size of the array, so I don't see the point of using the new operator, which indicates a dynamic array.
2) if the array is supposed to hold floating point numbers, why do you declare it type int?
3) what is the point of the variable scores (presently, it is just assigned the array index value squared)?
4) the variables average, sum, and length are not defined before they are used, and they are used before values are assigned to them.

Edited by DavidB

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.