Labels

Cerpen (18) html (16) movie (10) modul (7) SAP Security (2) c++ (2) Business (1)

Monday, 29 February 2016

GPA CALCULATOR

<html>
<head>
<title> This is GPA calculator </title>
<script type="text/javascript">
function cgpa()
{
var point1 = parseFloat(document.gpaForm.point1.value);
var point2 = parseFloat(document.gpaForm.point2.value);
var point3 = parseFloat(document.gpaForm.point3.value);
var point4 = parseFloat(document.gpaForm.point4.value);
var crhr1 = parseFloat(document.gpaForm.cr1.value) ;
var crhr2 = parseFloat(document.gpaForm.cr2.value) ;
var crhr3 = parseFloat(document.gpaForm.cr3.value) ;
var crhr4 = parseFloat(document.gpaForm.cr4.value) ;
var pointsub1 = point1 * crhr1;
var pointsub2 = point2 * crhr2;
var pointsub3 = point3 * crhr3;
var pointsub4 = point4 * crhr4;
var totcredithour = crhr1 + crhr2 + crhr3 + crhr4;
var totgpa = (pointsub1 + pointsub2 + pointsub3 + pointsub4) / totcredithour;
document.getElementById('gpa').value = parseFloat(totgpa).toFixed(2);
document.getElementById('semuahour').value = parseFloat(totcredithour).toFixed(2);
}
</script>
</head>
<body>
<center><h><font size="5" color="blue">This is a program to calculate GPA </font> <h2> </center>
<form name="gpaForm">
<table align = "center" width= "800" height="700" border="1" style="border-collapse:collapse">
<tr>
<td align= "center" colspan = 3 >
<h1><u><font face="verdana" >GPA CALCULATOR </u></h1>
</tr>
<tr>
<th>Course Code</th>
<th>Credit Hour</th>
<th>Grade</th>
</tr>
<tr>
<td align= "center" width= "200">
<input type="text" >
</td>
<td align= "center" width= "200">
<select id="cr1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td align= "center" width= "200">
<select id="point1" >
<option value="4.00">A</option>
<option value="3.75">A-</option>
<option value="3.50">B+</option>
<option value="3.00">B</option>
<option value="2.50">C+</option>
<option value="2.00">C</option>
<option value="1.50">D+</option>
<option value="1.00">D</option>
<option value="0.00">F</option>
</select>
</td>
</tr>
<td align= "center" width= "200">
<input type="text" >
</td>
<td align= "center" width= "200">
<select id="cr2" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td align= "center" width= "200">
<select id="point2" >
<option value="4.00">A</option>
<option value="3.75">A-</option>
<option value="3.50">B+</option>
<option value="3.00">B</option>
<option value="2.50">C+</option>
<option value="2.00">C</option>
<option value="1.50">D+</option>
<option value="1.00">D</option>
<option value="0.00">F</option>
</select>
</td>
<tr>
<td align= "center" width= "200">
<input id="text">
</td>
<td align= "center" width= "200">
<select id="cr3" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td align= "center" width= "200">
<select id="point3" >
<option value="4.00">A</option>
<option value="3.75">A-</option>
<option value="3.50">B+</option>
<option value="3.00">B</option>
<option value="2.50">C+</option>
<option value="2.00">C</option>
<option value="1.50">D+</option>
<option value="1.00">D</option>
<option value="0.00">F</option>
</select>
</td>
</tr>
<tr>
<td align= "center" width= "200">
<input type="text" >
</td>
<td align= "center" width= "200">
<select id="cr4" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td align= "center" width= "200">
<select id="point4" >
<option value="4.00">A</option>
<option value="3.75">A-</option>
<option value="3.50">B+</option>
<option value="3.00">B</option>
<option value="2.50">C+</option>
<option value="2.00">C</option>
<option value="1.50">D+</option>
<option value="1.00">D</option>
<option value="0.00">F</option>
</select>
</td>
</tr>
<tr>
<td colspan = 2>
<center><pre>Total Credit Hours : </pre></center>
</td>
<td align= "center" width= "200">
<input type="text" id="semuahour" name="result2" disabled="disabled" >
</td>
</tr>
<tr>
<td colspan = 2>
<center><strong><pre>GPA :</pre></center>
</td>
<td align= "center" width= "200">
<input type="text" id="gpa" name="result" disabled="disabled">
</td>
</tr>
<tr>
<td align= "center" colspan= 3>
<INPUT TYPE="button" NAME="button" Value="Calculate" onClick="cgpa()"/>
<button type="buttonre">Reset</button>
</td>
</tr>
</table>
</form>
</body>
</html>

No comments:

Post a Comment