Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Creating a grading rubric array

Hello, I'm taking a JS class and have an assignment where I need to create an array to store grades. The assignment is as follows:
You will create the pseudo-code and Java Script program which will prompt the user for four (4) numeric grades.

• Use an array to store the grades.
• Use a looping structure to populate the array.
• Calculate the numeric average based upon the 4 equally-weighted numeric grades.
• Display each of the 4 numeric grades from the array on the screen using a looping structure.
• Display the numeric average.
• Create a function that will convert the numeric average to a letter grade average using the grading scale:
o A = 90 to100
o B = 80 to 89
o C = 70 to 79
o D = 60 to 69
o F = 0 to 59
• The function must return the value of the letter grade average.
• Display the letter grade average.

I have been struggling with this class a lot, as I understand the theory but fall short on the implementation. Most of the assignments I have been trying to re-purpose some of my older code to make it work, but unfortunately I just don't get arrays at all.
I'm looking for anything to get me started or what have you, right now all that I have is this:
Code:
```<html>
<body>
<script type="text/javascript">

// Declare variables and constants
var SIZE = 5;		// size of array
var average;             // average of grades
var index;			// loop index
var ES = "";		// empty string
var BR = "<br />";	// HTML line break

// Prompt user to enter numeric values
for (index = 0; index < SIZE; index++) {
("Enter score value #" + (index + 1) +
":", ES);
}

document.write("Grades entered:" + BR + BR);
for (index = 0; index < SIZE; index ++) {
}

// Thank the user and end program
document.write("Thank you, have a great day." + BR);
</script>
</body>
</html>```

2. Do not use document.write in any program that modifies the screen after being loaded.
Doing so causes the program to reload and start over when executed, losing all earlier inputs.

Prompt is not a very good user entry mode. Anytime the user makes a mistake, they need to start all over AGAIN!
Note, all users make mistakes at the worst possible moment in any project.

Some questions:
1. Why do you create an array of 5 elements when only 4 are averaged. Which one is dropped?
OR consider changing SIZE = 4; since array start at 0 as in [0,1,2,3]. Array size is 4 entries.
2. Where is your attempt to sum the values to form the averages? Using 4 or 5 entries?
3. Where do you store the averages? A different array maybe?
Consider using several 'if .. then [.. else]' statements for this problem.

BTW, welcome to the forums.