home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / ref / adder.ba next >
Text File  |  2006-10-19  |  3KB  |  71 lines

  1.  
  2. Title: ADDER.BA V1.0
  3.  
  4. The Model 100 series computers do not come with a built in calculator.  Oh 
  5. sure, you can go into BASIC and enter commands like ?2+2 but what a drag when 
  6. you have to add up a lot of numbers, let alone provide a print out. 
  7.  
  8. There's lots of lists in this world that need adding and printing, like sales, 
  9. or credit card slips, or check stubs, taxable items, etc.  Most folks use a 
  10. tape calculator.  They enter all the items into the calculator and print a 
  11. total.  Then, they check each item against the tape.  And, if they entered any 
  12. one item wrong, they do the whole process over again, just to eliminate one 
  13. error. 
  14.  
  15. Programming an automatic adding machine is actually quite simple.  First, you 
  16. need to enter all your numbers into a .DO file called DATA.  Then enter 
  17. several numbers, and hit enter after each number.  Here are some rules about 
  18. numbers that you may find interesting.  
  19.  
  20. 1) Do not enter dollar signs or commas
  21. 2) The letter l is not the number 1
  22. 3) The letter O is not the number 0
  23.  
  24. When you're finished, go back to the menu. 
  25.  
  26. Next, go into BASIC and enter the following program.  
  27.  
  28. 10 'ADDER.BA Richard Hanson v1.0
  29. 20 'A public domain program, designed
  30. 30 'for the CLUB 100 online class
  31. 40 'entitled: Programming in BASIC. 
  32. 50 '
  33. 60 'CLUB 100: 415-939-1246 BBS
  34. 70 '
  35. 80 MAXFILES=1
  36. 90 OPEN"DATA.DO"FORINPUTAS1
  37. 100 IFEOF(1)THENCLOSE:GOTO150
  38. 110 INPUT#1,A
  39. 120 T=T+A
  40. 130 LPRINTUSING"##,###.##";A
  41. 140 GOTO100
  42. 150 LPRINT"---------"
  43. 160 LPRINTUSING"$#,###.##";T
  44. 170 MENU
  45.  
  46. When you are finished, save the program with the command: SAVE"ADDER" 
  47.  
  48. It is important that you entered the program exactly as indicated.  If you 
  49. need to make changes, you may enter the command, EDIT, and hit enter.  The 
  50. EDIT command places the program into your TEXT editor.  Make any necessary 
  51. changes.  When you are finished, hit your F8 function key to return to BASIC.  
  52. Your changes are made.  Lastly, hit your F8 function key, once again, to 
  53. return to the menu. 
  54.  
  55. It's time to give it a try.  The ADDER.BA program assumes that you have a 
  56. printer attached to your computer, and that it is turned on.  If this is not 
  57. so, the program will just sit there, and you will have to do a SHIFT BREAK to 
  58. stop the process. 
  59.  
  60.  
  61. ASSIGNMENT
  62.  
  63. 1) Using the 01 series files in this class section, write an explanation for 
  64.    each line of code in this program.  Then, using REM statements, annotate 
  65.    the ADDER.BA program. 
  66. 2) How big of a number will this program correctly display?  HINT: Place 
  67.    bigger numbers in your DATA.DO file and test ADDER.BA on them. 
  68. 3) Increase the PRINTUSING format string to handle larger numbers. 
  69.  
  70. <EOF>
  71.