IUP Computer Science
CO 300 Spring 1999

Project #2
(Due 5 pm 19 Feb 1999)

John Woolloomooloo runs a profitable business selling high quality didjeridoos throughout New South Wales. John sells the didjeridoos using the following unusual schedule of prices:

Quantity       Total Price         Quantity       Total Price
    1            58 A$                59           2360 A$
   10           510 A$               100           3600 A$
   25          1125 A$             > 100         Quantity * 36 A$
All prices are shown in whole Australian dollars (A$); in fact, John makes all sales in whole A$, discarding any fraction of a A$ that would result from a computed price. For purchases in which the quantity is other than what the schedule lists, interpolation is used to determine the total price. For example, if 40 didjeridoos are purchased, the quantity (Q) is 40, the lower schedule quantity (LQ) is 25, the higher schedule quantity (HQ) is 59, the lower total price (LP) is 1125, and the higher total price (HP) is 2360. The price (1669 A$) is computed using thr formula on the left (substitution shown on the right).

(Q-LQ) * (HP-LP)            (40 - 25) * (2360 - 1125)
---------------- + LP       ------------------------- + 1125
     (HQ-LQ)                        (59 - 25)

Your assignment is to write an assembly language program that can calculate the price of any number of didjeridoos using John's price schedule. Your program should repeatedly prompt for the number of didjeridoos purchased, read the number entered, and display purchase price. For example, if the program prompts with "Didjeridoo quantity?" and 40 is entered, the program could respond with "Purchasing 40 didjeridoos costs 1669 A$". Your program should terminate when the number entered is zero or negative.

Your program is required to use arrays to hold the quantities and prices for the schedule. It must use these arrays to determine total price of any purchase.

Hand in a .LIS file printout of your assembled program and a CARBONCOPY of a run of the program in which you find the cost of: 1, 20, 1001, 81, and 3 didjeridoos, in that order.