MakeChange.html (have difficulty writing this code)
Here's the task that I am having a little difficulty with:
This Web page is to calculate the change that should be given to a customer as they pay for a purchase. Ask the
user for the amount of the purchase and the amount of cash provided by the customer. When the user clicks on a
button you provide, it should calculate and display how many of each of the following needs to be given to the
customer to provide the correct change.
$100 bill
$20 bill
$10 bill
$5 bill
$1 bill
Quarter
Dime
Nickel
Penny
I'm pretty new to writing html, and not quite sure how I would do this for my assignment. If anyone could help that would be tremendous.
Try to write the code yourself, and post it here when and if it doesn't work. If you want someone to do your homework for you then hire somebody to do it for you--and they will probably want the cash up front. If you won't make the effort to try to write the code for yourself why should anyone else bother to make such an effort for you?
This is weird and bizarre. What kind of keyboard are you using? In your line of code in your DisplayOperators() function
Code:
changeleft = totaldllrgvn – totalamtprchs;
the 'minus' symbol is different from what comes from my keyboard. When I eliminated it and replaced it with what passes for a 'minus' on my keyboard your first field did indeed produce the desired effect for the field with the id 't_subtract' whereas it didn't before.
I looked at your code again. Actually it does work if, besides what I pointed out above:
1. Change your HTML where it defines the id for 't_twenties' It should be id = 't_twenties' You have id - 't_twenties'. A simple typo.
2. Your script is calling a function called 'DisplayFunctions();' but its not defined anywhere. I commented it out, and made the changes indicated above, and it does work.
Any document needs a Doctype. The way you have coded, your document needs an XHTML Doctype. If so, your comments like <!------------------------------> should disappear. The standard HTML comment should look precisely as
Code:
<!-- comment text inside -->
Under XHTML the embedded javascript code should be encapsulated in CDATA islands
Bookmarks