Intro to internet applications com-340-dl01 programming exercise 3
Programming exercise 3
6.16 Write a script that asks the user to enter two numbers, obtains the two numbers from the
user and outputs text that displays the sum, product, difference and quotient of the two numbers.
Use the techniques shown in Fig. 6.7.
6.18 Write a script that takes three integers from the user and displays the sum, average, product, smallest and largest of the numbers in an alert dialog.
7.12 Develop a script 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 script 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 script should output HTML5 text that displays the message “Credit limit exceeded.”
7.13 A large company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of the items sold by each salesperson. The values of these items are as follows:
Develop a script that inputs one salesperson’s items sold for last week, calculates the salesperson’s earnings and outputs HTML5 text that displays the salesperson’s earnings.