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!

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.