Wednesday, September 12, 2018

Money Bill Denomination in JavaScript

In this article, I would like to share with you a program written by my student named Bliss Jay Gayon. I already ask permission to him to publish his work in my website which he agrees upon. I would like to thank Bliss for sharing this program with us. 

What the program does it will ask the user to give an amount and it will compute the bill denomination based on the amount given by the user using JavaScript.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com, jakerpomperada@aol.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

My personal website is http://www.jakerpomperada.com



Sample Program Output

Program Listing

<DOCTYPE html>
<html>
<head>
<style>

div{
    background-color: lightgrey;
    width: 500px;
    border: 25px solid green;
    padding: 25px;
    margin: 25px;
}
input
{
padding:8px;
display:block;
border:none;
border-bottom:1px solid #ccc;width:100%
}

</style>

</head>

<div>
<h1>Denomination</h1>
<h5>made bt: Bliss Jay Gayon (9/12/18)</h5>
  <label for="prelim">Prelim Grade </label>
    <input type="text" id="prelim" class="input" name="prelim" placeholder="Enter Amount">
  <button type="submit" class="input" onclick="myFunction()">Try it</button>
  

<p style="color:black;" id="demo"></p>

</div>


<script>
function myFunction() {
  var prelim = document.getElementById("prelim").value;
  var average = parseInt(prelim)/1000;
  var fivehundred = parseInt(prelim)/500;
  var twohundred = parseInt(prelim)/200;
  var onehundred = parseInt(prelim)/100;
  var fifty = parseInt(prelim)/50;
  var twenty = parseInt(prelim)/20;
  
  
  var n = average - (average % 1 );
  var a = fivehundred - (fivehundred % 1);
  var b = twohundred - (twohundred % 1);
  var c = onehundred - (onehundred % 1);
  var d = fifty - (fifty % 1);
  var e = twenty - (twenty % 1);
  
  document.getElementById("demo").innerHTML = " There Are " +n+ ", 1000 Bills and " +a+ ", 500 Bills  and " +b+ ", 200 Bills </br> and " +c+ ", 100 Bills  and " +d+ ", 50 Bills and " +e+ ", 20 Bills";
}
</script>
</form>

</body>
</html>




No comments:

Post a Comment