Money counter

Write some JS to count money, and pay bills. It opens like this:

Start

As the user clicks on the bills, the total goes up by the appropriate amount. You can use these images:

Bill

Bill

Bill

The "Pay bill" button reduces the amount. When the user clicks on the button, your app should ask how much to pay:

Input

Check the value. Make sure it's a number, and positive. If not, show an error message.

Hint: isNaN(amount)

If there isn't enough money, show an error message:

Too much

If the input amount is OK, deduct it from the total.

Hint: money -= parseFloat(billAmount);

Submit the URL of your page.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Referenced in: