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












share|improve this question



















  • 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














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












share|improve this question



















  • 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












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












share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3