Answer to Section 7.12 Write a JavaScript Program for the following problem.

Develop a JavaScript program that will determine whether a department-store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:
1. Account number
2. Balance at the beginning of the month
3. Total of all items charged by this customer this month
4. Total of all credits applied to this customer’s account this month
5. Allowed credit limit
The program should input each of these facts from a prompt dialog as an integer, calculate the new balance (= beginning balance + charges – credits), display the new balance and determine whether the new balance exceeds the customer’s credit limit. For customers whose credit limit is exceeded, the program should output XHTML text that displays the message “Credit limit exceeded.”
Back to chapter 7


Credit Limit Check



Account Number Credit Limit Open Balance Charges Credits Balance Available Credit