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...
Which of the following statements are true?
a. java.util.List inherits all the methods from java.util.Collection. Additionally, it contains new methods for manipulating a list. b. The AbstractList class provides a partial implementation for the List interface. c. ArrayList is a concrete implementation of List using an array. d. LinkedList is a concrete implementation of List using a linked list. LinkedList contains all the methods in List and additional new methods for manipulating a linked list. e. ListIterator is a subinterface of Iterator and it provides the methods to support bi-directional traversal of a list.
The Increase Indent button indents the contents of a cell to the right by three spaces each time you click it.
Answer the following statement true (T) or false (F)