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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

60 Percent to DecimalChecking, interest, sales tax, and other financial programsare more "user friendly" if you don't have to makemanual conversions in your head. For example, if youknow your savings account earns 8 percent interest, andyou need to multiply by the decimal value for 8 percent(which is 0.08), it is easier to be able to enter 8 and let theTIMEX figure out the decimal value.Here's another way to change percentages to decimalsinside a program to simplify entry by permittingpercents to be entered as simple numbers.For some examples, try entering a price of 2.50 and asales tax percentage of 6. Your TIMEX will find the billtotals $2.65. Or try $7.80 and 5 percent tax. The bill will be$8.19. Try $123.75 at 8 percent tax. The bill will total$133.65.Program Listing10 LET T=ftf20 LET B=ftf30 PRINT •PRICE: $•;40 INPUT P50 PRINT P60 PRINT 0 SALES TAX RATE: •;70 INPUT R80 PRINT R; 0 PERCENT•90 LET T=O.Ol*R100 LET B=P+T*R110 PRINT •BILL TOTALS: $•;B61 Every 10th AnswerThis program generates a random number in therange of zero to 999. However, it has a difference. It onlyshows you every tenth number it generates.77

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

Saved successfully!

Ooh no, something went wrong!