Write an html code to display a chart of marks obtained by 6 students in 6 subjects
[hint: take the name of the students and the subject and marks among 100 as your own]
Answers
Explanation:
function getReport(){
var grade = ""; //declare a variable for grade
var result=""; //declare a variable for result
//read the marks
var engMarks = document.getElementById('txtEnglish').value;
var kannadaMarks = document.getElementById('txtKannada').value;
var mathsMarks = document.getElementById('txtMaths').value;
var scienceMarks = document.getElementById('txtScience').value;
//calculate the total marks (using double notation technique)
var totalMarks = engMarks - (- kannadaMarks) - (- mathsMarks) - (- scienceMarks);
//get the average marks
var averageMarks = totalMarks / 4;
//find the grade and result using the ternary operator inside the switch statement
switch(
//usage of ternary operator inside switch
(averageMarks > 60 && averageMarks <= 100) ? 1 :
(averageMarks > 50 && averageMarks < 60) ? 2 :
(averageMarks > 40 && averageMarks < 50) ? 3 : 0
)
{
case 1 :grade = "A";result="First Class";break;
case 2 :grade = "B"; result="Second Class";break;
case 3 :grade = "C"; result="Third Class";break;
case 0 :grade = "D"; result="Fail";break;
}
//display the results
document.getElementById('txtStudentName').value = document.getElementById('txtName').value;
document.getElementById('txtStudentClass').value = document.getElementById('txtClass').value;
document.getElementById('txtTotalMarks').value = totalMarks;
document.getElementById('txtAvgMarks').value = averageMarks;
document.getElementById('txtGrade').value = grade;
document.getElementById('txtResult').value = result;
} //end of function getReport
Answer:
Explanation:
<Html>
<Head>
<Title>result<\title>
<\head>
<Body>
<Table border="4" align="center">
<Tr>
<Th>NAME</th>
<Th>Science <\th>
<Th>English</th>
<Th>Maths</th>
<Th>computer</th>
<Th>Arts</th>
</Tr>
<Tr>
<Td>Nikhil Singh </td>
<Td>88<\td>
<Td>89<\td>
<Td>90<\td>
<Td>98<\td>
<Td>99<\td>
</Tr><tr>
<Td>Aryan Singh </td>
<Td>98<\td>
<Td>79<\td>
<Td>90<\td>
<Td>99<\td>
<Td>70<\td>
</Tr><tr>
<Td>nihal singh </td>
<Td>89<\td>
<Td>87<\td>
<Td>99<\td>
<Td>99<\td>
<Td>99<\td>
</Tr><tr>
<Td>bittu singh </td>
<Td>80<\td>
<Td>87<\td>
<Td>40<\td>
<Td>70<\td>
<Td>45<\td>
</Tr><tr>
<Td>Pankaj raj</td>
<Td>82<\td>
<Td>89<\td>
<Td>96<\td>
<Td>70<\td>
<Td>90<\td>
</Tr><tr>
<Td>subhem singh </td>
<Td>80<\td>
<Td>89<\td>
<Td>80<\td>
<Td>78<\td>
<Td>89<\td>
</Tr><tr>
<\table>
<\body>
<\html>
Hope it is helpful.. ......bye.fraind.