Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will create the pseudo-code and Java Script program which will prompt the us

ID: 3859331 • Letter: Y

Question

You will create the pseudo-code and Java Script program which will prompt the user for four (4) numeric grades. Requirements: • 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. • Include comments o At the top of the program to include: Your name Class name and number Instructor name Overall Description of program o Comment each section of code Describe what the section accomplishes

Explanation / Answer

PSEUDO-CODE

doctype html
html
head
title=Grading system in JavaScript
script (type='text/javascript')
function CalculateAverage(inputGrades)
Initialize average to 0
Initialize sum to 0
Initialize looping variable var2 to 0

for var2 from 0 to 3
calculate sum by adding values from array
calculate average by dividing sum by 4.
then return calculated average.

function LetterGrade(average)
if (100>=average>=90) then return A
else if (89>=average>=80) then return B
else if (79>=average>=70) then return C
else if (69>=average>=60) then return D
else return F

Initialize array grades to []
Initialize looping variable var1 to 0
Initialize average to 0

for var 1 from 0 to 4
prompt user with a dialog box to enter grade and add that grade to array.

call CalculateAverage function

for var 1 from 0 to 4
display grades

Display average
call LetterGrade function
Display letter Grade.

JAVASCRIPT PROGRAM-

<!--
Name:
Class Name:
Number :
Description :
Instructor Name:
-->

<!DOCTYPE html>
<html>
<head>
<title>Grading system in JavaScript</title>
<script language="javascript" type="text/javascript" >
<!--This function calculates average -->
function CalculateAverage(inputGrades){
var average=0;
var sum=0;
var var2=0;
for(var2=0;var2<4;var2++){
sum+=inputGrades[var2]; <!--Calculate sum of all the grades -->
}
average=sum/4;
return average;

}
<!--This function calculates letter grade-->
function LetterGrade(average){
if(average>=90 && average<=100){
return "A";
}
else if(average>=80 && average<=89){
return "B";
}
else if(average>=70 && average<=79){
return "C";
}
else if(average>=60 && average<=69){
return "D";
}else{
return "F"
}
}
<!--Declare variables -->
var grades=[];
var var1=0;
var average=0;

<!--Assigning user inputed value to the array.-->
for(var1=0;var1<4;var1++){
grades[var1]=parseInt (prompt ("Enter grade:"," "));
}

<!--Call CalculateAverage function to calculate average -->
average=parseInt(CalculateAverage(grades));

<!--Display values stored in array.-->
for(var1=0;var1<4;var1++){
document.write("<b>Grade " + parseInt(var1+1) +" : </b>"+grades[var1] +"</br>");
}
<!--Display average-->
document.write("<b>Average : </b>" + average+"</br>");

<!--Call LetterGrade function to calculate letter grade -->
var letterGrade=LetterGrade(average);

<!--Display leter grade-->
document.write("<b>Letter Grade Average : </b>" + letterGrade);
  
</script>
</head>
<body>
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote