Question: What is wrong with my code? Please help me to fix some issues in this code. Could you help me to calculate the average and

What is wrong with my code? Please help me to fix some issues in this code.
Could you help me to calculate the average and display the latter grade according to the number grade input. (issues: average and latter grade) Thank you
Note: This is javascript and html code.
Grading Papers

Grading Paper

// Filename gradingpapers.html
// Program loops until the teacher does not have any
// additional students
var names = new Array();
var grades = new Array();
var latterGrade = new Array();
var ans = 'Y';
i = 0;
total = 0;
while (ans == 'Y' || ans=='y') // checks if students input is capital or small letter Y or y
{
names[i] = prompt("Enter student name:"); //prompt for asking the student to enter his/her name
grades[i] = prompt("What was their test grade?"); // prompt for enter his/her grade
if(grades[i]>= 90 || grades[i]
{
total1 = grades; //taken the total1 variable to store the value of grade/
latterGrade = 'A';
}
if(grades[i]>=80 || grades[i]
{
total1= grades; //taken the total1 variable to store the value of grade/
latterGrade = 'B';
}
if(grades[i]>=70 || grades[i]
{
total1=grades; //taken the total1 variable to store the value of grade/
latterGrade = 'C';
}
if(grades[i]>=60 || grades[i]
{
total1=grades; //taken the total1 variable to store the value of grade/
latterGrade = 'D';
}
if(grades[i]>60) // checks if grades of input student is F or f if it is the execute the condition otherwise go to the next condition
{
total1=grades; //taken the total1 variable to store the value of grade/
latterGrade = 'F';
}
total += parseFloat(grades); //adding total1 value to total for calculate the average.
ans = prompt("Do you have another grade? (Y/N)");
++i;
}
for (j = 0; j
{
document.write("
"); //formatting ouput to the table rows and columns using html tag in javascript
}
average = total / j; //calculate the average of the all student and stores in average variable
document.write("
"); //writing the javascript value to the html table /formatting ouput to the table rows and columns using html tag in javascript
" +names[j] + " got a " + grades[j] + " " + latterGrade[j] + "
and
" + "

The class average was

" + average + "
and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!