خرید بک لینک
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.

x95 Use an array to store the grades.
x95 Use a looping structure to populate the array.
x95 Calculate the numeric average based upon the 4 equally-weighted numeric grades.
x95 Display each of the 4 numeric grades from the array on the screen using a looping structure.
x95 Display the numeric average.
x95 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
x95 The function must return the value of the letter grade average.
x95 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 grades;              // array for grades
var average;            // average of grades
var index;                        // loop index
var ES = "";                // empty string
var BR = "<br />";        // HTML line break

// Create grade array
grades = new Array(SIZE);

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

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

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

Thank you so much for any help you can give me!

برچسب: نویسنده: آیلین رضوانی تاريخ: يکشنبه 12 آذر 1396 ساعت: 19:12

صفحه بندی