-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
34 lines (33 loc) · 1.31 KB
/
Copy pathscript.js
File metadata and controls
34 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function calculator()
{
var name=document.calc.name.value;
var firstobt=parseInt(document.calc.firstobt.value);
var secondobt=parseInt(document.calc.secondobt.value);
var firsttot=parseInt(document.calc.firsttot.value);
var secondtot=parseInt(document.calc.secondtot.value);
var thirdobt=parseInt(document.calc.thirdobt.value);
var fourthobt=parseInt(document.calc.fourthobt.value);
var thirdtot=parseInt(document.calc.thirdtot.value);
var fourthtot=parseInt(document.calc.fourthtot.value);
var fifthobt=parseInt(document.calc.fifthobt.value);
var sixthobt=parseInt(document.calc.sixthobt.value);
var fifthtot=parseInt(document.calc.fifthtot.value);
var sixthtot=parseInt(document.calc.sixthtot.value);
fsobt=(firstobt+secondobt)*.25;
fstot=(firsttot+secondtot)*.25;
tfobt=(thirdobt+fourthobt)*.50;
tftot=(thirdtot+fourthtot)*.50;
fsxobt=fifthobt+sixthobt;
fsxtot=fifthtot+sixthtot;
allobt=fsobt+tfobt+fsxobt;
alltot=fstot+tftot+fsxtot;
percen=(allobt/alltot)*100;
if(percen)
{
document.write("<br><br><br><br><br><br><center>Congratulation "+name+"! Your percentage(%) have calculated.<br><br>You have got "+percen+"%.</center>");
}
else
{
document.write("<br><br><br><br><br><br><center>Something were wrong. Please input correct and valid data.<br>Try Again!</center>")
}
}