change calculator..denominations (quarters, dimes, nickels, pennies). are not printing the correct amount
up vote
0
down vote
favorite
Need help denominations (quarters, dimes, nickels, pennies are not printing). Each denomination, dollars, quarters, dimes, nickels, pennies, is suppose to print the correct change due.
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
javascript
add a comment |
up vote
0
down vote
favorite
Need help denominations (quarters, dimes, nickels, pennies are not printing). Each denomination, dollars, quarters, dimes, nickels, pennies, is suppose to print the correct change due.
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
javascript
1
Welcome! Is code supposed to put output of each step in a place on your webpage?document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?
– jacob.mccrumb
Nov 11 at 4:10
1
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Need help denominations (quarters, dimes, nickels, pennies are not printing). Each denomination, dollars, quarters, dimes, nickels, pennies, is suppose to print the correct change due.
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
javascript
Need help denominations (quarters, dimes, nickels, pennies are not printing). Each denomination, dollars, quarters, dimes, nickels, pennies, is suppose to print the correct change due.
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
function calculateChange()
var amountDue = document.getElementById('amount-due').value;
var amountReceived = document.getElementById('amount-received').value;
////////////////////////////////////
//dollars to print dollar mount
dollars = Math.floor(amountReceived % amountDue);
document.getElementById("dollars-output").innerHTML = dollars;
var quarters = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = quarters;
// var quarters to print # of quarters in change
var dimes = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = dimes;
// var dimes to print # of dimes in change
///////////////////////////////////////
var nickels = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = nickels;
//var nickels to print # of nickels in change////////////////////////////////////
//math.floor to do math
//var pennies to print # of pennies in change
var pennies = Math.floor(amountReceived% dollars);
document.getElementById('quarters-output').innerHTML = pennies;
return;
// to return the output of code
javascript
javascript
edited Nov 12 at 15:50
Coli
348113
348113
asked Nov 11 at 3:12
junior
142
142
1
Welcome! Is code supposed to put output of each step in a place on your webpage?document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?
– jacob.mccrumb
Nov 11 at 4:10
1
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45
add a comment |
1
Welcome! Is code supposed to put output of each step in a place on your webpage?document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?
– jacob.mccrumb
Nov 11 at 4:10
1
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45
1
1
Welcome! Is code supposed to put output of each step in a place on your webpage?
document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?– jacob.mccrumb
Nov 11 at 4:10
Welcome! Is code supposed to put output of each step in a place on your webpage?
document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?– jacob.mccrumb
Nov 11 at 4:10
1
1
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245533%2fchange-calculator-denominations-quarters-dimes-nickels-pennies-are-not-pr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome! Is code supposed to put output of each step in a place on your webpage?
document.getElementById('quarters-output')
is used for each value so it will try and put them all in the same place. Could you clarify what the current output is, and what the expected output is?– jacob.mccrumb
Nov 11 at 4:10
1
include all the code in the codeblock
– Matthew L Daniel
Nov 11 at 4:45