JAVA SCRIPT ASSIGNMENT


Assalamualaikum and hai!

MID TERM JAVASCRIPT


QUESTIONS:

Interactive Creative Design (STIV2053) subject allocates its mark percentage by 60% and 40% where the 60% represents the coursework and the 40% represents the final exam. 
Coursework is constituted of quizzes, assignments and a final project which carry the percentage of 10%, 20%, and 30% respectively. 
There are 10 quizzes and only the best five are selected to be calculated as a part of the carry mark AUTOMATICALLY. Four assignments must be completed in order to contribute to the carry mark’s total and as for the final project; a complete Interactive Creative Design work along with a written report must be submitted. Both carry the percentages of 20% and 10% respectively.
Develop a system that counts the total percentage of the subject and based on the total percentage obtained by using JavaScript + HTML and send thru this online as a single zip file.

OUTPUT:





The coding are as follows:

<html>
<title> Student Grading System</title>
<style>
h3 {
font-family: "arial"; color: black; align:center;
}
table, td, th {
font-family: "arial"; color: black;
}
div {
font-family: "arial"; font-size: 18px; color: black;
}
</style>
<script type="text/javascript">
function test()
{
var _stud_name = document.grade.stud_name;
var _course = document.grade.course ;
var _subject = document.grade.subject;
var _matric_no = document.grade.matric_no
var _quiz = document.grade.quiz;
var _assignment = document.grade.assignment;
var _finalproject = document.grade.finalproject;
var _finalexam = document.grade.finalexam;
if (_stud_name.value=="" || _stud_name.value==null) {
_stud_name.focus();
alert("Student name field cannot be empty.");
return false;
}
else if (_course.value=="" || _course.value==null) {
_course.focus();
alert("Course field cannot be empty.");
return false;
}
else if (_subject.value=="" || _subject.value==null) {
_subject.focus();
alert("Subject field cannot be empty.");
return false;
}
else if (_matric_no.value=="" || _matric_no.value==null) {
_matric_no.focus();
alert("Matric No field cannot be empty.");
return false;
}
else if (_quiz.value=="" || _quiz.value==null) {
_quiz.focus();
alert("Quiz cannot be empty.");
return false;
}
else if (_assignment.value=="" || _assignment.value==null) {
_assignment.focus();
alert("Assignment cannot be empty.");
return false;
}
else if (_finalproject.value=="" || _finalproject.value==null) {
_finalproject.focus();
alert("Final Project cannot be empty.");
return false;
}
else if (_finalexam.value=="" || _finalexam.value==null) {
_finalexam.focus();
alert("Final Exam cannot be empty.");
return false;
}
quiz_grade=document.grade.quiz.value;
assignment_grade=document.grade.assignment.value;
finalproject_grade=document.grade.finalproject.value;
finalexam_grade=document.grade.finalexam.value;
var solve_quiz = parseInt(quiz_grade) ;
var solve_assignment = parseInt(assignment_grade) ;
var solve_finalproject = parseInt(finalproject_grade) ;
var solve_finalexam = parseInt(finalexam_grade) ;
final_grade = (solve_quiz + solve_assignment + solve_finalproject + solve_finalexam);
final_grade2 = final_grade.toFixed();
if (final_grade2 >= 100) {
remarks = "You are putting a wrong mark for percentage allocated."
}
else if(final_grade2 >= 80) {
remarks = "A";
}
else if (final_grade2 >= 60) {
remarks = "B";
}
else if (final_grade >= 50) {
remarks = "C";
}
else if (final_grade2 >= 40) {
remarks = "D";
}
else {
remarks = "F";
}
report_title="Student's Summary Result";
stud_name = document.grade.stud_name.value;
stud_course = document.grade.course.value;
stud_subject = document.grade.subject.value;
stud_matric_no = document.grade.matric_no.value;
content ="Final Mark : " + final_grade2 + "%"
document.getElementById('report_title').innerHTML = report_title;
document.getElementById('stud_name').innerHTML = "Name :" + stud_name;
document.getElementById('course').innerHTML = "Course :" + stud_course;
document.getElementById('subject').innerHTML = "Subject :" + stud_subject;
document.getElementById('matric_no').innerHTML = "Matric No :" + stud_matric_no;
document.getElementById('final_grade').innerHTML = content;
document.getElementById('remarks').innerHTML = "Grade : " + remarks;
}
</script>
<body>
<body>
<h2> Interactive Creative Design Grading System (STIV2053)</h2>
<br>
Gentle reminder:
<br>
1. Please insert student name, student course name and student matric number. <br>
2. Please key in the marks in each section.<br>
3. For quiz, the mark represent is 10 marks. <br>
4. For assignment, the mark represent is 20 marks. <br>
5. For final project, the mark represent is 25 marks and the report is represent 5 marks which total 30 marks overall.<br>
6. For final exam, it represent 40 marks from the overall result.<br>
7. Lastly, click the "Final Grade" button to get the summary of the student's result.<br>
<br>
<br>
<hr><table border="1" align="center" width="35%">
<tr>
<td bgcolor="lightblue">
<br>
<h3><b><center>STUDENT GRADING SYSTEM</center></b></h3>
<form method="post" name="grade" >
<table><center>
<tr>
<td align="right">Student Name :</td>
<td align="left"><input type="text" name="stud_name" size="40" /></td>
</tr>
<tr>
<td align="right">Course:</td>
<td align="left"><input type="text" name="course" size="40" /></td>
</tr>
<tr>
<td align="right">Subject:</td>
<td align="left"><input type="text" name="subject" size="40" /></td>
</tr>
<tr>
<td align="right">Matric No :</td>
<td align="left"><input type="text" name="matric_no" size="40" /></td>
</tr><td> &nbsp; </td>
<tr>
<td align="right">Quiz:</td>
<td align="left"><input type="text" name="quiz" size="1" />/10%</td>
</tr>
<tr>
<td align="right">Assignment:</td>
<td align="left"><input type="text" name="assignment" size="1" />/20%</td>
</tr>
<td align="right">Final Project:</td>
<td align="left"><input type="text" name="finalproject" size="1" />/30%</td>
</tr>
<tr>
<td align="right">Final Exam:</td>
<td align="left"><input type="text" name="finalexam" size="1" />/40%</td>
</tr>
<td> &nbsp; </td>
<tr>
<td><center>
<input type="button" value="Final Grade" align="center"
onclick="test();"><br>
</center>
</td>
</tr>
</center>
</table>
</form>
<br> <center><b>
<div id="report_title"> </div> </b>
<br></center>
<table border="1" align="center">
<tr><td bgcolor="white">
<div id="stud_name"> </div>
<div id="course"> </div>
<div id="subject"> </div>
<div id="matric_no"> </div>
<div id="final_grade"> </div>
<div id="remarks"> </div></td></tr></table><br>
</td>
</tr>
</body>
</html>


Thank you and enjoy your day! :)

Assalamualaikum W.B.T. ;)




Comments