
write a java script program that would input the ff:Student Name,Average,Tuition Fee and output Total Tuition Fee. Formula: Total Tuition Fee=Tuition Fee-Discount If average is: 95-100 100% discount 90-94 25% 85-89 10% 84 and below no discount Sample Output: Student Name:_ Average:_ Tuition Fee:_ Discount:_ Total Fee:__

Hi Friend,
Try the following code:
<html>
<head><title>Tution Fee</title>
<script>
function findDiscount(){
var total;
var discount;
var sname=document.form.name.value;
var average=document.form.average.value;
var fee=document.form.tfee.value;
alert(average);
if(average>=95)
{
discount="100%";
total=0;
}
else if(average>=90&&average<=94){
discount=0.25*fee;
total=fee-discount;
}
else if(average>=85&&average<=89){
discount=.10*fee;
total=fee-discount;
}
else if(average<=84){
discount="No Discount";
total=fee;
}
document.writeln("Student Name: "+sname+"<br>");
document.writeln("Average: "+average+"<br>");
document.writeln("Tution Fee: "+fee+"<br>");
document.writeln("Discount: "+discount+"<br>");
document.writeln("Total Fee: "+total);
}
</script>
</head>
<form name="form">
<table>
<tr><td>Student Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Average of Marks:</td><td><input type="text" name="average"></td></tr>
<tr><td>Tution Fee:</td><td><input type="text" name="tfee"></td></tr>
<tr><td></td><td><input type="button" value="Submit" onclick="findDiscount();"></td></tr>
</table>
</form>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.