var grades = []; document.writeln("Welcome to the grade calculator!"); var numClasses = prompt("How many classes are you taking?"); //use a for loop to iterate, one for each class. Prompt for their grade. Store the response in the array grades. Use push method to add the new item to the array. for (var i = 0; i < numClasses.length; i++){ console.log (numClasses[i]); } var question = prompt ("What was your grade in class " + i + "?"); grades.push(i); //Once all of the grades have been entered and stored in the array, calculate the average grade. First use another for loop to calculate the sum of all grades, then dividing that sum by the number of classes to get the average. for ( var j = 0; j < grades.length; j ++){ var avg = (grades[j] / grades.length) * grades.length } if (avg < 60) { document.writeln("Keep studying! Review your notes and work every night."); } else if (avg >=60 && < 80) { document.writeln("Be sure to review your work; you can do it!"); } else { document.writeln("Way to go! Keep up the good work."): }
var question = prompt (What was your grade in class " + i + "?")
var question = prompt ("What was your grade in class " + i + "?");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)