0% found this document useful (0 votes)
30 views2 pages

Js Sop 6

The document outlines an experiment for creating a JavaScript program that calculates the average marks of students based on six subjects. It includes a grading system with specified ranges for grades A to F. The provided HTML and JavaScript code enables user input for marks and displays the average and corresponding grade upon submission.

Uploaded by

sanikawadhavane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Js Sop 6

The document outlines an experiment for creating a JavaScript program that calculates the average marks of students based on six subjects. It includes a grading system with specified ranges for grades A to F. The provided HTML and JavaScript code enables user input for marks and displays the average and corresponding grade upon submission.

Uploaded by

sanikawadhavane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SVSPM’S

Gayatri College Of Commerce & Science Charholi,Pune.


DEPARTMENT OF INFORMATION TECHNOLOGY
Roll No. Div: Class: F.Y.J.S/S.Y.J.C Performed On :
Stream: Science/Commerce Expt. No. Submitted On:
Student Name: Remarks:

Title Of Experiment: Create JavaScript program which Teacher’s Signature :


compute the average marks of students

Q. Create JavaScript program which compute the average marks of


students. Accept six subject marks of student from user. Calculate
average marks of student which is used to determine the
corresponding grades.

Range Grade
35 to 60 F
61 to 70 D
71 to 80 C
81 to 90 B
91 to 100 A

<html>
<title>Javascript program</title>
<head>
<script type="text/javascript">
function calculate_grade(){
var m1,m2,m3,m4,m5,m6,avg;
m1=parseInt(form1.txt_eng.value);
m2=parseInt(form1.txt_phy.value);
m3=parseInt(form1.txt_chem.value);
m4=parseInt(form1.txt_it.value);
m5=parseInt(form1.txt_maths.value);
m6=parseInt(form1.txt_bio.value);
avg=(m1+m2+m3+m4+m5+m6)/6;
alert("Average marks of students for six subjects is:"+ avg);
if(avg>=91 && avg<=100)
{
grade = 'A';
}
else if(avg>=81 && avg<=90)
{
grade = 'B';
}
else if(avg>=71 && avg<=80)
{
grade = 'C';
}
else if(avg>=61 && avg<=70)
{
grade = 'D';
}
else if (avg>=35 && avg<=60)
{
grade = 'F';
}
alert ("Grade of the student is: "+ grade);
}
</script>
</head>
<body bgcolor="pink">
<form name="form1" method="post">
<p><h1>Enter Marks of subjects of students</h1><br><br>
English <input type="text" name="txt_eng"><br><br>
Physics <input type="text" name="txt_phy"><br><br>
Chemistry <input type="text" name="txt_chem"><br><br>
IT <input type="text" name="txt_it"><br><br>
Maths <input type="text" name="txt_maths"><br><br>
Biology <input type="text" name="txt_bio"><br><br>
<input type="submit" value="Calculate Average & print grade"
onclick="calculate_grade()">
</form>
</body>
</html>

You might also like