12.07.2015 Views

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Shopper's FriendTake your computer along the next time you goshopping!This program finds the computer asking for certaininformation and then telling you which product brand nameis the best buy.The computer wil ask for the brand name of a product,the quantity in the product package, and the price of thepackage. Then it will ask for the name, quantity and pricefor a second product.After digesting all this information, it will tell you thebrand name of the best-buy product and show you the unitprices for both brand names so you can agree with thecomputer's judgment.For example, suppose you were looking at corn flakesin boxes, one by Post and one by Kellogg. Suppose the Posi:box contained 24 ounces of flakes and was priced on thegrocery shelf at $1.98 while the Kellogg box held 18 ouncesand was priced at $1.59. Which would be the better buybased on unit price per ounce of flakes?Run the data through your TIMEX and you'll find itcomputes the Post corn flakes to be the best buy with a unitprice of 8¢ vs. the Kellogg unit price of 9¢.After completing the computation, the computer asksfor a yes or no answer. Do you have more to be computed?By the way, if the unit prices turn out to be equal, thecomputer will say they are equal. If you want no furthercomputations, it will say thanks and quit.10 PRINT ~SHOPPERS FRIEND~20 FOR L=l TO 1530 PRINT '"*"";40 JN!EXT L50 PRINT100 PRINT ~FIRST BRAND NAME:~110 INPUT X$120 PRINT X$130 PRINT ~QUANTITY~ ~~87

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!