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:
a) Account number
b) Balance at the beginning of the month
c) Total of all items charged by this customer this month
d) Total of all credits applied to this customer's account this month
e) Allowed credit limit
The program should input each of these facts from prompt dialogs as integers, 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 those
customers whose credit limit is exceeded, the program should output HTML text that displays the message, “Credit limit exceeded.”
Top:
Determine if each of an arbitrary number of department store customers has exceeded the credit limit on a charge
account.
First refinement:
Input the account number, beginning balance, total charges, total credits, and credit limit for a customer, calculate the
customer’s new balance and determine if the balance exceeds the credit limit. Then process the next customer.
Second refinement:
Input the first customer’s account number
While the sentinel value (-1) has not been entered for the account number
Input the customer’s beginning balance
Input the customer’s total charges
Input the customer’s total credits
Input the customer’s credit limit
Calculate the customer’s new balance
If the balance exceeds the credit limit
Print the account number
Print the credit limit
Print the balance
Print "Credit Limit Exceeded"
Input the next customer’s account number
```
1
2
3
4
5
6 <
You might also like to view...
This property of a control allows it be positioned a specified distance from the outside edge of the form.
a. dock b. anchor c. attach d. secure
The ____ category of the Insert panel is used to create and insert the most frequently used objects, such as images, templates, media elements, and tables.
A. Common B. Layout C. Application D. HTML
In JavaScript, the ____ statement should be accompanied by an error message, which is not enclosed in parentheses.
A. throw B. case C. try D. catch
The list of enumeration constants in an enumerated type are enclosed in a set of brackets.
Answer the following statement true (T) or false (F)