Design Zakat Calculator using Java Script

Written by Zaheer Alam

Design Zakat Calculator using Java Script:

Don’t forget to add Java script online/off line files in project, without Java script files it will not work. Add script in a single file or manage it as you wish.

function Calculator() {

var a = $(‘.a’).val(); if (a === “”){a = 0;}
var b = $(‘.b’).val(); if (b === “”) {b = 0;}
var c= $(‘.c’).val();if (c === “”){c = 0;}
var d = $(‘.d’).val();if (d === “”){d = 0;}
var zakat = 2.5; var n = 100; var e = parseInt(a) + parseInt(b) + parseInt(c) + parseInt(d); var result = e * zakat / n;


HTML Form for Input from User:

<form name=”cal” action=””>
<input class=”a” type=”text” name=”a” value=”0″ /></br>
<input class=”b” type=”text” name=”b” value=”0″/></br>
<input class=”c” type=”text” name=”c” value=”0″/></br>
<input class=”d” type=”text” name=”d” value=”0″/></br>

<input type=”button” value=”Submit” name=”Submit” onclick=”Calculator()” />
<h1>Total: <input type=”textbox” name=”” class=”total” value=””></h1>

About the author

Zaheer Alam

Zaheer Alam is an Software Engineer Graduated From Well Versed institute of Aisa, Comsats University.He is inclined toward helping People improve their Programming Skill to the Next Level.He also works work as social media content creator on various pages and groups with the huge fan following.

Leave a Comment