Kwaku runs a profitable business selling high quality calabashes to Dagbani traders. Kwaku sells the calabashes using the following unusual schedule of prices:
Quantity Total Price Quantity Total Price
1 ₵37 99 ₵2673
6 ₵210 200 ₵5000
15 ₵480 459 ₵11016
40 ₵1160 > 459 ₵24 * Quantity
All prices are shown in whole cedis (₵); in fact, Kwaku makes all sales in whole cedis, discarding any fraction of a cedi 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 50 calabashes are purchased, the price is computed as
(50 - 40) * (2673 - 1160)
1160 + ------------------------- = 1416
(99 - 40)
Your assignment is to write an assembly language program that can calculate the price of any number of calabashes using Kwaku's schedule. Your program should repeatedly prompt for the number of calabashes purchased, read the number entered, and display purchase price. For example, if the program prompted with "Calabash quantity?" and 50 was entered, the program could respond with "Purchasing 50 calabashes costs 1416 cedis". Your program should terminate when the number entered is zero.
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 at least five different numbers of calabashes are entered. At least one of these numbers must be 1375 or greater; at least one number should be a number in the schedule (i.e., 1, 6, 15, 40, 99, 200, or 459); and at least three numbers should fall in different intervals within the schedule.