home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / BASMAN1.ARC / CHAP3.DOC < prev    next >
Unknown  |  1987-12-12  |  28.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert WANG Integrated Word Processor (document/wangIWP) ext Unsupported
1% dexvert Dynamic Publisher Document (document/dynamicPublisherDocument) ext Unsupported
1% dexvert Excellence! Document (document/excellenceDocument) ext Unsupported
1% dexvert Norton Textra Writer (document/textraWriter) ext Unsupported
1% dexvert IBM DisplayWrite Document (document/ibmDisplayWriteDocument) ext Unsupported
100% file data default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 1b 32 1b 55 00 1b 36 1b | 38 1b 41 0c 1b 32 1b 47 |.2.U..6.|8.A..2.G|
|00000010| 1b 43 42 0d 0a 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |.CB.....|... |
|00000020| 1b 45 43 48 41 50 54 45 | 52 20 33 1b 46 20 20 20 |.ECHAPTE|R 3.F |
|00000030| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 20 43 4c | | .E CL|
|00000040| 45 41 4e 49 4e 47 20 55 | 50 20 54 48 45 20 41 43 |EANING U|P THE AC|
|00000050| 54 1b 46 20 1b 45 20 20 | 20 1b 46 20 20 20 20 20 |T.F .E | .F |
|00000060| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 43 48 41 | | .ECHA|
|00000070| 50 54 45 52 20 33 0d 0a | 0d 0a 0d 0a 20 20 20 20 |PTER 3..|.... |
|00000080| 20 1b 46 54 68 65 20 6f | 75 74 70 75 74 20 66 72 | .FThe o|utput fr|
|00000090| 6f 6d 20 74 68 65 20 73 | 61 6d 70 6c 65 20 70 72 |om the s|ample pr|
|000000a0| 6f 67 72 61 6d 20 69 6e | 20 63 68 61 70 74 65 72 |ogram in| chapter|
|000000b0| 20 32 20 6c 69 6e 65 64 | 20 75 70 20 70 65 72 66 | 2 lined| up perf|
|000000c0| 65 63 74 6c 79 2c 0d 0a | 20 20 20 20 20 64 69 64 |ectly,..| did|
|000000d0| 6e 27 74 20 69 74 3f 20 | 20 4f 6e 20 74 68 65 20 |n't it? | On the |
|000000e0| 6f 74 68 65 72 20 68 61 | 6e 64 2c 20 74 68 65 20 |other ha|nd, the |
|000000f0| 6f 75 74 70 75 74 20 66 | 72 6f 6d 20 79 6f 75 72 |output f|rom your|
|00000100| 20 65 78 65 72 63 69 73 | 65 20 6c 6f 6f 6b 65 64 | exercis|e looked|
|00000110| 20 61 0d 0a 20 20 20 20 | 20 6c 69 74 74 6c 65 20 | a.. | little |
|00000120| 72 61 67 67 65 64 2e 20 | 20 59 6f 75 27 72 65 20 |ragged. | You're |
|00000130| 72 69 67 68 74 2c 20 77 | 65 20 63 68 65 61 74 65 |right, w|e cheate|
|00000140| 64 2e 20 20 41 6c 6c 20 | 74 68 65 20 6e 61 6d 65 |d. All |the name|
|00000150| 73 20 61 6e 64 20 61 63 | 63 6f 75 6e 74 0d 0a 20 |s and ac|count.. |
|00000160| 20 20 20 20 6e 75 6d 62 | 65 72 73 20 69 6e 20 74 | numb|ers in t|
|00000170| 68 65 20 73 61 6d 70 6c | 65 20 70 72 6f 67 72 61 |he sampl|e progra|
|00000180| 6d 20 77 65 72 65 20 65 | 78 61 63 74 6c 79 20 74 |m were e|xactly t|
|00000190| 68 65 20 73 61 6d 65 20 | 6c 65 6e 67 74 68 2e 20 |he same |length. |
|000001a0| 20 41 73 20 61 0d 0a 20 | 20 20 20 20 72 65 73 75 | As a.. | resu|
|000001b0| 6c 74 2c 20 77 68 65 6e | 20 79 6f 75 20 75 73 65 |lt, when| you use|
|000001c0| 64 20 74 68 65 20 3b 22 | 20 20 20 20 20 20 20 22 |d the ;"| "|
|000001d0| 3b 20 69 6e 20 74 68 65 | 20 50 52 49 4e 54 20 73 |; in the| PRINT s|
|000001e0| 74 61 74 65 6d 65 6e 74 | 20 65 76 65 72 79 74 68 |tatement| everyth|
|000001f0| 69 6e 67 0d 0a 20 20 20 | 20 20 63 61 6d 65 20 6f |ing.. | came o|
|00000200| 75 74 20 70 65 72 66 65 | 63 74 2e 20 20 4e 65 69 |ut perfe|ct. Nei|
|00000210| 74 68 65 72 20 6c 69 66 | 65 20 6e 6f 72 20 70 72 |ther lif|e nor pr|
|00000220| 6f 67 72 61 6d 6d 69 6e | 67 20 69 73 20 75 73 75 |ogrammin|g is usu|
|00000230| 61 6c 6c 79 20 6c 69 6b | 65 20 74 68 61 74 2e 0d |ally lik|e that..|
|00000240| 0a 20 20 20 20 20 4e 6f | 74 20 6d 75 63 68 20 77 |. No|t much w|
|00000250| 65 20 63 61 6e 20 64 6f | 20 61 62 6f 75 74 20 6c |e can do| about l|
|00000260| 69 66 65 2c 20 62 75 74 | 20 74 68 65 72 65 20 69 |ife, but| there i|
|00000270| 73 20 73 6f 6d 65 74 68 | 69 6e 67 20 77 65 20 63 |s someth|ing we c|
|00000280| 61 6e 20 64 6f 20 74 6f | 20 68 65 6c 70 0d 0a 20 |an do to| help.. |
|00000290| 20 20 20 20 77 69 74 68 | 20 74 68 65 20 70 72 6f | with| the pro|
|000002a0| 67 72 61 6d 6d 69 6e 67 | 2e 0d 0a 0d 0a 0d 0a 20 |gramming|....... |
|000002b0| 20 20 20 20 1b 45 50 52 | 49 4e 54 20 55 53 49 4e | .EPR|INT USIN|
|000002c0| 47 0d 0a 0d 0a 20 20 20 | 20 20 1b 46 54 68 65 20 |G.... | .FThe |
|000002d0| 6f 75 74 70 75 74 20 66 | 72 6f 6d 20 61 6e 79 20 |output f|rom any |
|000002e0| 62 75 73 69 6e 65 73 73 | 20 70 72 6f 67 72 61 6d |business| program|
|000002f0| 20 6d 75 73 74 20 61 70 | 70 65 61 72 20 70 72 6f | must ap|pear pro|
|00000300| 66 65 73 73 69 6f 6e 61 | 6c 2e 20 20 28 41 6c 6c |fessiona|l. (All|
|00000310| 0d 0a 20 20 20 20 20 74 | 68 65 20 61 6e 73 77 65 |.. t|he answe|
|00000320| 72 73 20 63 61 6e 20 62 | 65 20 77 72 6f 6e 67 20 |rs can b|e wrong |
|00000330| 62 75 74 20 61 73 20 6c | 6f 6e 67 20 61 73 20 65 |but as l|ong as e|
|00000340| 76 65 72 79 74 68 69 6e | 67 20 69 73 20 6c 69 6e |verythin|g is lin|
|00000350| 65 64 20 75 70 20 70 65 | 6f 70 6c 65 0d 0a 20 20 |ed up pe|ople.. |
|00000360| 20 20 20 77 69 6c 6c 20 | 62 65 6c 69 65 76 65 20 | will |believe |
|00000370| 69 74 2e 29 20 20 42 41 | 53 49 43 41 20 68 61 73 |it.) BA|SICA has|
|00000380| 20 73 6f 6d 65 20 69 6e | 73 74 72 75 63 74 69 6f | some in|structio|
|00000390| 6e 73 20 66 6f 72 20 70 | 72 6f 76 69 64 69 6e 67 |ns for p|roviding|
|000003a0| 20 66 6f 72 6d 61 74 74 | 65 64 0d 0a 20 20 20 20 | formatt|ed.. |
|000003b0| 20 6f 75 74 70 75 74 2e | 20 20 54 68 65 20 50 52 | output.| The PR|
|000003c0| 49 4e 54 20 55 53 49 4e | 47 20 62 65 6c 6f 6e 67 |INT USIN|G belong|
|000003d0| 73 20 69 6e 20 74 68 69 | 73 20 61 72 65 6e 61 2e |s in thi|s arena.|
|000003e0| 20 20 4c 65 74 27 73 20 | 67 6f 20 62 61 63 6b 20 | Let's |go back |
|000003f0| 74 6f 20 6f 75 72 0d 0a | 20 20 20 20 20 73 61 6d |to our..| sam|
|00000400| 70 6c 65 20 70 72 6f 67 | 72 61 6d 20 61 6e 64 20 |ple prog|ram and |
|00000410| 75 70 67 72 61 64 65 20 | 74 68 65 20 69 74 20 77 |upgrade |the it w|
|00000420| 69 74 68 20 50 52 49 4e | 54 20 55 53 49 4e 47 27 |ith PRIN|T USING'|
|00000430| 73 2e 0d 0a 0d 0a 20 20 | 20 20 20 46 69 72 73 74 |s..... | First|
|00000440| 20 77 65 20 68 61 76 65 | 20 74 6f 20 64 65 73 63 | we have| to desc|
|00000450| 72 69 62 65 20 68 6f 77 | 20 77 65 20 77 61 6e 74 |ribe how| we want|
|00000460| 20 74 68 65 20 6f 75 74 | 70 75 74 20 74 6f 20 61 | the out|put to a|
|00000470| 70 70 65 61 72 2e 20 20 | 54 68 69 73 20 69 73 0d |ppear. |This is.|
|00000480| 0a 20 20 20 20 20 64 6f | 6e 65 20 74 68 72 6f 75 |. do|ne throu|
|00000490| 67 68 20 61 20 66 6f 72 | 6d 61 74 2c 20 6f 72 20 |gh a for|mat, or |
|000004a0| 6d 61 73 6b 2c 20 74 68 | 61 74 20 69 6e 73 74 72 |mask, th|at instr|
|000004b0| 75 63 74 73 20 42 41 53 | 49 43 20 77 68 65 72 65 |ucts BAS|IC where|
|000004c0| 20 74 68 65 20 66 69 65 | 6c 64 73 20 67 6f 0d 0a | the fie|lds go..|
|000004d0| 20 20 20 20 20 61 6e 64 | 20 68 6f 77 20 77 65 20 | and| how we |
|000004e0| 77 61 6e 74 20 74 68 65 | 6d 20 74 6f 20 6c 6f 6f |want the|m to loo|
|000004f0| 6b 2e 20 20 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |k. The |followin|
|00000500| 67 20 66 6f 72 6d 61 74 | 20 73 74 61 74 65 6d 65 |g format| stateme|
|00000510| 6e 74 20 64 65 73 63 72 | 69 62 65 73 0d 0a 20 20 |nt descr|ibes.. |
|00000520| 20 20 20 61 6e 20 61 6c | 70 68 61 20 64 65 70 61 | an al|pha depa|
|00000530| 72 74 6d 65 6e 74 20 6e | 61 6d 65 2c 20 61 6e 20 |rtment n|ame, an |
|00000540| 61 63 63 6f 75 6e 74 20 | 6e 75 6d 62 65 72 20 77 |account |number w|
|00000550| 69 74 68 20 6e 6f 20 64 | 65 63 69 6d 61 6c 73 2c |ith no d|ecimals,|
|00000560| 20 74 68 65 20 6e 75 6d | 62 65 72 0d 0a 20 20 20 | the num|ber.. |
|00000570| 20 20 6f 66 20 70 68 6f | 6e 65 73 20 77 69 74 68 | of pho|nes with|
|00000580| 20 6e 6f 20 64 65 63 69 | 6d 61 6c 20 61 6e 64 20 | no deci|mal and |
|00000590| 61 20 63 6f 73 74 20 77 | 69 74 68 20 74 77 6f 20 |a cost w|ith two |
|000005a0| 64 65 63 69 6d 61 6c 20 | 70 6c 61 63 65 73 3a 0d |decimal |places:.|
|000005b0| 0a 0d 0a 20 20 20 20 20 | 33 31 35 20 46 4d 54 31 |... |315 FMT1|
|000005c0| 24 20 3d 20 22 5c 20 20 | 20 20 20 20 20 20 20 20 |$ = "\ | |
|000005d0| 5c 20 20 20 20 23 23 23 | 23 23 23 20 20 20 20 20 |\ ###|### |
|000005e0| 20 20 20 20 20 23 23 20 | 20 20 20 20 20 20 20 20 | ## | |
|000005f0| 23 2c 23 23 23 2e 23 23 | 22 0d 0a 0d 0a 20 20 20 |#,###.##|".... |
|00000600| 20 20 41 6c 70 68 61 20 | 6f 72 20 73 74 72 69 6e | Alpha |or strin|
|00000610| 67 20 66 69 65 6c 64 73 | 20 61 72 65 20 64 65 66 |g fields| are def|
|00000620| 69 6e 65 64 20 75 73 69 | 6e 67 20 5c 20 20 20 20 |ined usi|ng \ |
|00000630| 5c 2e 20 20 4e 75 6d 62 | 65 72 73 20 61 72 65 20 |\. Numb|ers are |
|00000640| 64 65 66 69 6e 65 64 0d | 0a 20 20 20 20 20 75 73 |defined.|. us|
|00000650| 69 6e 67 20 23 20 73 69 | 67 6e 73 2e 20 20 54 68 |ing # si|gns. Th|
|00000660| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 23 20 73 69 |e number| of # si|
|00000670| 67 6e 73 20 64 65 66 69 | 6e 65 73 20 74 68 65 20 |gns defi|nes the |
|00000680| 73 69 7a 65 20 6f 66 20 | 74 68 65 20 66 69 65 6c |size of |the fiel|
|00000690| 64 2e 0d 0a 20 20 20 20 | 20 41 73 20 79 6f 75 20 |d... | As you |
|000006a0| 63 61 6e 20 73 65 65 20 | 69 6e 20 74 68 65 20 6c |can see |in the l|
|000006b0| 61 73 74 20 66 69 65 6c | 64 2c 20 61 20 70 65 72 |ast fiel|d, a per|
|000006c0| 69 6f 64 20 77 69 74 68 | 20 74 72 61 69 6c 69 6e |iod with| trailin|
|000006d0| 67 20 23 20 73 69 67 6e | 73 0d 0a 20 20 20 20 20 |g # sign|s.. |
|000006e0| 64 65 66 69 6e 65 73 20 | 64 65 63 69 6d 61 6c 20 |defines |decimal |
|000006f0| 70 6f 69 6e 74 73 2c 20 | 61 6e 64 20 69 66 20 77 |points, |and if w|
|00000700| 65 20 77 61 6e 74 20 63 | 6f 6d 6d 61 73 20 69 6e |e want c|ommas in|
|00000710| 20 74 68 65 20 6f 75 74 | 70 75 74 20 74 68 6f 73 | the out|put thos|
|00000720| 65 20 63 61 6e 0d 0a 20 | 20 20 20 20 62 65 20 65 |e can.. | be e|
|00000730| 6d 62 65 64 64 65 64 20 | 61 73 20 77 65 6c 6c 2e |mbedded |as well.|
|00000740| 20 20 54 68 65 20 6c 6f | 63 61 74 69 6f 6e 20 6f | The lo|cation o|
|00000750| 66 20 61 20 66 69 65 6c | 64 20 69 6e 20 74 68 65 |f a fiel|d in the|
|00000760| 20 66 6f 72 6d 61 74 20 | 65 73 74 61 62 6c 69 73 | format |establis|
|00000770| 68 65 73 0d 0a 20 20 20 | 20 20 77 68 65 72 65 20 |hes.. | where |
|00000780| 69 74 20 67 6f 65 73 20 | 6f 6e 20 74 68 65 20 70 |it goes |on the p|
|00000790| 61 67 65 2e 20 20 50 72 | 65 74 74 79 20 65 61 73 |age. Pr|etty eas|
|000007a0| 79 20 2c 20 69 73 6e 27 | 74 20 69 74 2e 20 20 4e |y , isn'|t it. N|
|000007b0| 6f 74 65 20 74 68 65 20 | 6c 69 6e 65 0d 0a 20 20 |ote the |line.. |
|000007c0| 20 20 20 6e 75 6d 62 65 | 72 2e 20 20 42 61 73 65 | numbe|r. Base|
|000007d0| 64 20 6f 6e 20 74 68 65 | 20 6c 69 6e 65 20 6e 75 |d on the| line nu|
|000007e0| 6d 62 65 72 73 20 61 73 | 73 69 67 6e 65 64 20 69 |mbers as|signed i|
|000007f0| 6e 20 74 68 65 20 73 61 | 6d 70 6c 65 20 65 78 65 |n the sa|mple exe|
|00000800| 72 63 69 73 65 20 69 6e | 0d 0a 20 20 20 20 20 43 |rcise in|.. C|
|00000810| 68 61 70 74 65 72 20 32 | 2c 20 74 68 69 73 20 70 |hapter 2|, this p|
|00000820| 75 74 73 20 74 68 65 20 | 66 6f 72 6d 61 74 20 73 |uts the |format s|
|00000830| 74 61 74 65 6d 65 6e 74 | 20 77 69 74 68 20 74 68 |tatement| with th|
|00000840| 65 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 6f 66 0d |e defini|tion of.|
|00000850| 0a 20 20 20 20 20 63 6f | 6e 73 74 61 6e 74 73 2e |. co|nstants.|
|00000860| 20 20 4c 69 6b 65 20 63 | 6f 6e 73 74 61 6e 74 73 | Like c|onstants|
|00000870| 2c 20 77 65 20 63 61 6e | 20 74 68 65 6e 20 61 6c |, we can| then al|
|00000880| 77 61 79 73 20 66 69 6e | 64 20 74 68 65 6d 20 77 |ways fin|d them w|
|00000890| 68 65 6e 20 77 65 20 6e | 65 65 64 0d 0a 20 20 20 |hen we n|eed.. |
|000008a0| 20 20 74 6f 20 6d 61 6b | 65 20 61 20 63 68 61 6e | to mak|e a chan|
|000008b0| 67 65 2e 0d 0a 0d 0a 20 | 20 20 20 20 41 66 74 65 |ge..... | Afte|
|000008c0| 72 20 63 72 65 61 74 69 | 6e 67 20 74 68 65 20 66 |r creati|ng the f|
|000008d0| 6f 72 6d 61 74 2c 20 79 | 6f 75 20 6d 75 73 74 20 |ormat, y|ou must |
|000008e0| 74 65 6c 6c 20 74 68 65 | 20 50 52 49 4e 54 20 73 |tell the| PRINT s|
|000008f0| 74 61 74 65 6d 65 6e 74 | 20 74 6f 20 27 75 73 65 |tatement| to 'use|
|00000900| 27 0d 0a 20 20 20 20 20 | 69 74 2e 20 20 48 65 6e |'.. |it. Hen|
|00000910| 63 65 20 74 68 65 20 74 | 65 72 6d 69 6e 6f 6c 6f |ce the t|erminolo|
|00000920| 67 79 20 50 52 49 4e 54 | 20 55 53 49 4e 47 3a 0d |gy PRINT| USING:.|
|00000930| 0a 0d 0a 20 20 20 20 20 | 34 36 30 20 20 20 20 20 |... |460 |
|00000940| 50 52 49 4e 54 20 55 53 | 49 4e 47 20 46 4d 54 31 |PRINT US|ING FMT1|
|00000950| 24 3b 20 44 45 50 54 24 | 2c 20 41 43 43 54 2e 4e |$; DEPT$|, ACCT.N|
|00000960| 55 4d 2c 20 50 48 4f 4e | 45 53 2c 20 43 48 41 52 |UM, PHON|ES, CHAR|
|00000970| 47 45 0d 0a 0d 0a 20 20 | 20 20 20 54 68 65 20 50 |GE.... | The P|
|00000980| 52 49 4e 54 20 55 53 49 | 4e 47 20 46 4d 54 31 24 |RINT USI|NG FMT1$|
|00000990| 20 6d 65 61 6e 73 20 70 | 72 69 6e 74 20 74 68 69 | means p|rint thi|
|000009a0| 73 20 64 61 74 61 20 75 | 73 69 6e 67 20 74 68 65 |s data u|sing the|
|000009b0| 20 6d 61 73 6b 20 64 65 | 73 63 72 69 62 65 64 20 | mask de|scribed |
|000009c0| 62 79 0d 0a 20 20 20 20 | 20 74 68 65 20 73 74 72 |by.. | the str|
|000009d0| 69 6e 67 20 76 61 72 69 | 61 62 6c 65 20 46 4d 54 |ing vari|able FMT|
|000009e0| 31 24 2e 20 20 49 66 20 | 79 6f 75 20 6e 65 65 64 |1$. If |you need|
|000009f0| 20 6d 6f 72 65 20 66 6f | 72 6d 61 74 20 73 74 61 | more fo|rmat sta|
|00000a00| 74 65 6d 65 6e 74 73 2c | 20 79 6f 75 0d 0a 20 20 |tements,| you.. |
|00000a10| 20 20 20 63 72 65 61 74 | 65 20 74 68 65 6d 20 6f | creat|e them o|
|00000a20| 6e 20 61 6e 6f 74 68 65 | 72 20 6c 69 6e 65 20 75 |n anothe|r line u|
|00000a30| 73 69 6e 67 20 64 69 66 | 66 65 72 65 6e 74 20 6e |sing dif|ferent n|
|00000a40| 61 6d 65 73 20 73 75 63 | 68 20 61 73 20 46 4d 54 |ames suc|h as FMT|
|00000a50| 32 24 2c 20 46 4d 54 33 | 24 0d 0a 20 20 20 20 20 |2$, FMT3|$.. |
|00000a60| 65 74 63 2e 20 20 53 6f | 6d 65 20 63 61 75 74 69 |etc. So|me cauti|
|00000a70| 6f 6e 73 3a 0d 0a 0d 0a | 20 20 20 20 20 2d 20 41 |ons:....| - A|
|00000a80| 6c 77 61 79 73 20 6d 61 | 6b 65 20 73 75 72 65 20 |lways ma|ke sure |
|00000a90| 79 6f 75 20 68 61 76 65 | 20 65 6e 6f 75 67 68 20 |you have| enough |
|00000aa0| 23 20 73 69 67 6e 73 20 | 69 6e 20 65 61 63 68 20 |# signs |in each |
|00000ab0| 66 69 65 6c 64 20 74 6f | 20 63 6f 76 65 72 20 74 |field to| cover t|
|00000ac0| 68 65 0d 0a 20 20 20 20 | 20 20 20 6c 61 72 67 65 |he.. | large|
|00000ad0| 73 74 20 6f 63 63 75 72 | 72 65 6e 63 65 20 6f 66 |st occur|rence of|
|00000ae0| 20 74 68 61 74 20 66 69 | 65 6c 64 2e 20 20 49 74 | that fi|eld. It|
|00000af0| 20 64 6f 65 73 6e 27 74 | 20 68 75 72 74 20 65 78 | doesn't| hurt ex|
|00000b00| 74 72 61 73 2e 0d 0a 20 | 20 20 20 20 2d 20 4d 61 |tras... | - Ma|
|00000b10| 6b 65 20 73 75 72 65 20 | 79 6f 75 20 68 61 76 65 |ke sure |you have|
|00000b20| 20 6f 6e 65 20 66 69 65 | 6c 64 20 64 65 73 63 72 | one fie|ld descr|
|00000b30| 69 62 65 64 20 66 6f 72 | 20 65 61 63 68 20 69 74 |ibed for| each it|
|00000b40| 65 6d 20 69 6e 20 74 68 | 65 20 50 52 49 4e 54 0d |em in th|e PRINT.|
|00000b50| 0a 20 20 20 20 20 20 20 | 73 74 61 74 65 6d 65 6e |. |statemen|
|00000b60| 74 2e 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 20 20 20 20 |t.......|.... |
|00000b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 20 | | .E |
|00000b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|00000b90| 46 20 20 20 20 20 1b 45 | 20 20 32 33 0d 0a 0d 0a |F .E| 23....|
|00000ba0| 0c 0d 0a 0d 0a 0d 0a 0d | 0a 1b 46 20 20 20 20 20 |........|..F |
|00000bb0| 1b 45 43 48 41 50 54 45 | 52 20 33 1b 46 20 20 20 |.ECHAPTE|R 3.F |
|00000bc0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 20 43 4c | | .E CL|
|00000bd0| 45 41 4e 49 4e 47 20 55 | 50 20 54 48 45 20 41 43 |EANING U|P THE AC|
|00000be0| 54 1b 46 20 1b 45 20 20 | 20 1b 46 20 20 20 20 20 |T.F .E | .F |
|00000bf0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 43 48 41 | | .ECHA|
|00000c00| 50 54 45 52 20 33 0d 0a | 0d 0a 0d 0a 20 20 20 20 |PTER 3..|.... |
|00000c10| 20 54 41 42 0d 0a 0d 0a | 20 20 20 20 20 1b 46 57 | TAB....| .FW|
|00000c20| 68 65 6e 20 77 65 20 66 | 69 72 73 74 20 64 69 73 |hen we f|irst dis|
|00000c30| 63 75 73 73 65 64 20 74 | 68 65 20 50 52 49 4e 54 |cussed t|he PRINT|
|00000c40| 20 66 75 6e 63 74 69 6f | 6e 20 77 65 20 6d 65 6e | functio|n we men|
|00000c50| 74 69 6f 6e 65 64 20 74 | 68 61 74 20 42 41 53 49 |tioned t|hat BASI|
|00000c60| 43 20 74 61 62 73 0d 0a | 20 20 20 20 20 74 6f 20 |C tabs..| to |
|00000c70| 63 65 72 74 61 69 6e 20 | 70 72 65 64 65 66 69 6e |certain |predefin|
|00000c80| 65 64 20 70 6f 73 69 74 | 69 6f 6e 73 20 62 79 20 |ed posit|ions by |
|00000c90| 64 65 66 61 75 6c 74 2e | 20 20 54 68 61 74 20 54 |default.| That T|
|00000ca0| 41 42 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 20 61 |AB funct|ion is a|
|00000cb0| 6c 73 6f 0d 0a 20 20 20 | 20 20 61 76 61 69 6c 61 |lso.. | availa|
|00000cc0| 62 6c 65 20 74 6f 20 79 | 6f 75 2e 0d 0a 0d 0a 20 |ble to y|ou..... |
|00000cd0| 20 20 20 20 33 36 30 20 | 50 52 49 4e 54 20 54 41 | 360 |PRINT TA|
|00000ce0| 42 28 31 32 29 3b 22 44 | 45 50 41 52 54 4d 45 4e |B(12);"D|EPARTMEN|
|00000cf0| 54 20 50 48 4f 4e 45 20 | 42 49 4c 4c 49 4e 47 22 |T PHONE |BILLING"|
|00000d00| 0d 0a 20 20 20 20 20 33 | 37 30 20 50 52 49 4e 54 |.. 3|70 PRINT|
|00000d10| 20 54 41 42 28 31 32 29 | 3b 22 3d 3d 3d 3d 3d 3d | TAB(12)|;"======|
|00000d20| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d30| 3d 3d 22 0d 0a 0d 0a 20 | 20 20 20 20 54 68 65 20 |==".... | The |
|00000d40| 54 41 42 28 6e 29 20 69 | 6e 73 74 72 75 63 74 69 |TAB(n) i|nstructi|
|00000d50| 6f 6e 20 74 65 6c 6c 73 | 20 74 68 65 20 63 6f 6d |on tells| the com|
|00000d60| 70 75 74 65 72 20 74 6f | 20 73 6b 69 70 20 74 6f |puter to| skip to|
|00000d70| 20 63 6f 6c 75 6d 6e 20 | 6e 20 62 65 66 6f 72 65 | column |n before|
|00000d80| 0d 0a 20 20 20 20 20 70 | 72 69 6e 74 69 6e 67 20 |.. p|rinting |
|00000d90| 6f 75 74 70 75 74 2e 20 | 20 4d 75 6c 74 69 70 6c |output. | Multipl|
|00000da0| 65 20 74 61 62 20 66 75 | 6e 63 74 69 6f 6e 73 20 |e tab fu|nctions |
|00000db0| 63 61 6e 20 62 65 20 70 | 72 65 73 65 6e 74 20 6f |can be p|resent o|
|00000dc0| 6e 20 74 68 65 20 73 61 | 6d 65 0d 0a 20 20 20 20 |n the sa|me.. |
|00000dd0| 20 6c 69 6e 65 2c 20 73 | 65 70 61 72 61 74 65 64 | line, s|eparated|
|00000de0| 20 66 72 6f 6d 20 74 68 | 65 20 6f 75 74 70 75 74 | from th|e output|
|00000df0| 20 76 61 72 69 61 62 6c | 65 73 20 62 79 20 73 65 | variabl|es by se|
|00000e00| 6d 69 63 6f 6c 6f 6e 73 | 2e 0d 0a 0d 0a 20 20 20 |micolons|..... |
|00000e10| 20 20 31 30 30 20 50 52 | 49 4e 54 20 54 41 42 28 | 100 PR|INT TAB(|
|00000e20| 31 30 29 3b 22 54 48 49 | 53 20 49 53 20 31 30 22 |10);"THI|S IS 10"|
|00000e30| 3b 54 41 42 28 33 30 29 | 3b 22 54 48 49 53 20 49 |;TAB(30)|;"THIS I|
|00000e40| 53 20 33 30 22 3b 54 41 | 42 28 35 30 29 3b 22 35 |S 30";TA|B(50);"5|
|00000e50| 30 20 21 21 21 22 0d 0a | 0d 0a 0d 0a 20 20 20 20 |0 !!!"..|.... |
|00000e60| 20 1b 45 41 43 43 55 4d | 55 4c 41 54 4f 52 53 20 | .EACCUM|ULATORS |
|00000e70| 41 4e 44 20 43 4f 55 4e | 54 45 52 53 0d 0a 0d 0a |AND COUN|TERS....|
|00000e80| 20 20 20 20 20 1b 46 54 | 68 65 72 65 20 63 6f 6d | .FT|here com|
|00000e90| 65 73 20 61 20 74 69 6d | 65 20 69 6e 20 65 76 65 |es a tim|e in eve|
|00000ea0| 72 79 20 79 6f 75 6e 67 | 20 70 72 6f 67 72 61 6d |ry young| program|
|00000eb0| 27 73 20 6c 69 66 65 20 | 77 68 65 6e 20 69 74 20 |'s life |when it |
|00000ec0| 68 61 73 20 74 6f 20 6b | 65 65 70 0d 0a 20 20 20 |has to k|eep.. |
|00000ed0| 20 20 74 72 61 63 6b 20 | 6f 66 20 74 6f 74 61 6c | track |of total|
|00000ee0| 73 2e 20 20 54 68 65 20 | 70 72 6f 67 72 61 6d 20 |s. The |program |
|00000ef0| 61 63 63 6f 6d 70 6c 69 | 73 68 65 73 20 74 68 69 |accompli|shes thi|
|00000f00| 73 20 69 6e 20 74 68 65 | 20 73 61 6d 65 20 77 61 |s in the| same wa|
|00000f10| 79 20 79 6f 75 0d 0a 20 | 20 20 20 20 77 6f 75 6c |y you.. | woul|
|00000f20| 64 2e 20 20 49 74 20 73 | 74 61 72 74 73 20 77 69 |d. It s|tarts wi|
|00000f30| 74 68 20 30 20 61 6e 64 | 20 6b 65 65 70 73 20 61 |th 0 and| keeps a|
|00000f40| 64 64 69 6e 67 20 61 73 | 20 69 74 20 67 6f 65 73 |dding as| it goes|
|00000f50| 20 61 6c 6f 6e 67 2e 20 | 20 20 45 72 67 6f 2c 20 | along. | Ergo, |
|00000f60| 73 74 65 70 0d 0a 20 20 | 20 20 20 6f 6e 65 20 63 |step.. | one c|
|00000f70| 6f 6e 73 69 73 74 73 20 | 6f 66 20 69 6e 69 74 69 |onsists |of initi|
|00000f80| 61 6c 69 7a 69 6e 67 20 | 28 73 65 74 74 69 6e 67 |alizing |(setting|
|00000f90| 20 61 20 73 74 61 72 74 | 69 6e 67 20 76 61 6c 75 | a start|ing valu|
|00000fa0| 65 20 66 6f 72 29 20 74 | 68 65 20 76 61 72 69 61 |e for) t|he varia|
|00000fb0| 62 6c 65 0d 0a 20 20 20 | 20 20 74 68 61 74 20 79 |ble.. | that y|
|00000fc0| 6f 75 20 61 72 65 20 75 | 73 69 6e 67 20 66 6f 72 |ou are u|sing for|
|00000fd0| 20 79 6f 75 72 20 61 63 | 63 75 6d 75 6c 61 74 6f | your ac|cumulato|
|00000fe0| 72 2e 20 20 57 68 65 72 | 65 20 74 68 69 73 20 69 |r. Wher|e this i|
|00000ff0| 73 20 64 6f 6e 65 20 77 | 69 6c 6c 20 63 68 61 6e |s done w|ill chan|
|00001000| 67 65 0d 0a 20 20 20 20 | 20 6c 61 74 65 72 20 6f |ge.. | later o|
|00001010| 6e 2c 20 62 75 74 20 66 | 6f 72 20 6e 6f 77 20 6c |n, but f|or now l|
|00001020| 65 74 27 73 20 64 6f 20 | 69 74 20 69 6e 20 74 68 |et's do |it in th|
|00001030| 65 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 6f 66 20 |e defini|tion of |
|00001040| 63 6f 6e 73 74 61 6e 74 | 73 2e 0d 0a 20 20 20 20 |constant|s... |
|00001050| 20 48 61 76 69 6e 67 20 | 69 6e 69 74 69 61 6c 69 | Having |initiali|
|00001060| 7a 65 64 20 6f 75 72 20 | 61 63 63 75 6d 75 6c 61 |zed our |accumula|
|00001070| 74 6f 72 2c 20 77 65 20 | 74 68 65 6e 20 61 63 63 |tor, we |then acc|
|00001080| 75 6d 75 6c 61 74 65 20 | 28 61 64 64 20 74 6f 20 |umulate |(add to |
|00001090| 69 74 29 20 61 73 0d 0a | 20 20 20 20 20 6e 65 65 |it) as..| nee|
|000010a0| 64 65 64 2e 0d 0a 0d 0a | 20 20 20 20 20 4e 6f 74 |ded.....| Not|
|000010b0| 65 20 74 68 61 74 20 77 | 65 20 6e 65 76 65 72 20 |e that w|e never |
|000010c0| 64 65 66 69 6e 65 64 20 | 77 68 61 74 20 69 73 20 |defined |what is |
|000010d0| 62 65 69 6e 67 20 61 63 | 63 75 6d 75 6c 61 74 65 |being ac|cumulate|
|000010e0| 64 2e 20 20 49 74 20 63 | 61 6e 20 62 65 20 70 61 |d. It c|an be pa|
|000010f0| 79 72 6f 6c 6c 0d 0a 20 | 20 20 20 20 74 6f 74 61 |yroll.. | tota|
|00001100| 6c 73 2c 20 74 68 65 20 | 63 6f 73 74 20 6f 66 20 |ls, the |cost of |
|00001110| 61 6c 6c 20 62 72 6f 77 | 6e 20 70 6f 6f 64 6c 65 |all brow|n poodle|
|00001120| 73 20 73 6f 6c 64 20 66 | 6f 72 20 74 68 65 20 64 |s sold f|or the d|
|00001130| 61 79 2c 20 6f 72 20 74 | 68 65 20 6e 75 6d 62 65 |ay, or t|he numbe|
|00001140| 72 20 6f 66 0d 0a 20 20 | 20 20 20 70 69 67 65 6f |r of.. | pigeo|
|00001150| 6e 73 20 74 68 61 74 20 | 68 61 76 65 20 6c 69 74 |ns that |have lit|
|00001160| 20 6f 6e 20 61 20 67 69 | 76 65 6e 20 73 74 61 74 | on a gi|ven stat|
|00001170| 75 65 20 69 6e 20 74 68 | 65 20 70 61 72 6b 2e 0d |ue in th|e park..|
|00001180| 0a 0d 0a 20 20 20 20 20 | 49 66 20 77 65 20 61 63 |... |If we ac|
|00001190| 63 75 6d 75 6c 61 74 65 | 20 62 79 20 61 64 64 69 |cumulate| by addi|
|000011a0| 6e 67 20 31 20 65 61 63 | 68 20 74 69 6d 65 2c 20 |ng 1 eac|h time, |
|000011b0| 77 65 20 61 72 65 20 70 | 65 72 66 6f 72 6d 69 6e |we are p|erformin|
|000011c0| 67 20 61 20 76 65 72 79 | 0d 0a 20 20 20 20 20 73 |g a very|.. s|
|000011d0| 70 65 63 69 66 69 63 20 | 74 61 73 6b 2e 20 20 59 |pecific |task. Y|
|000011e0| 6f 75 27 76 65 20 63 61 | 6c 6c 65 64 20 69 74 20 |ou've ca|lled it |
|000011f0| 63 6f 75 6e 74 69 6e 67 | 20 66 6f 72 20 6d 6f 73 |counting| for mos|
|00001200| 74 20 6f 66 20 79 6f 75 | 72 20 6c 69 66 65 2e 0d |t of you|r life..|
|00001210| 0a 20 20 20 20 20 43 6f | 72 72 65 63 74 2c 20 63 |. Co|rrect, c|
|00001220| 6f 75 6e 74 65 72 73 20 | 61 72 65 20 61 63 63 75 |ounters |are accu|
|00001230| 6d 75 6c 61 74 6f 72 73 | 20 74 68 61 74 20 79 6f |mulators| that yo|
|00001240| 75 20 61 64 64 20 31 20 | 74 6f 20 69 6e 20 6f 72 |u add 1 |to in or|
|00001250| 64 65 72 20 74 6f 20 67 | 65 74 0d 0a 20 20 20 20 |der to g|et.. |
|00001260| 20 74 6f 74 61 6c 20 63 | 6f 75 6e 74 73 2e 20 20 | total c|ounts. |
|00001270| 41 67 61 69 6e 2c 20 66 | 6f 72 20 6e 6f 77 20 61 |Again, f|or now a|
|00001280| 6c 6c 20 63 6f 75 6e 74 | 65 72 73 20 61 6e 64 20 |ll count|ers and |
|00001290| 61 63 63 75 6d 75 6c 61 | 74 6f 72 73 20 6d 75 73 |accumula|tors mus|
|000012a0| 74 20 62 65 0d 0a 20 20 | 20 20 20 69 6e 69 74 69 |t be.. | initi|
|000012b0| 61 6c 69 7a 65 64 20 61 | 74 20 74 68 65 20 62 65 |alized a|t the be|
|000012c0| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 79 6f 75 72 20 |ginning |of your |
|000012d0| 70 72 6f 67 72 61 6d 2e | 0d 0a 0d 0a 20 20 20 20 |program.|.... |
|000012e0| 20 4c 65 74 27 73 20 61 | 64 64 20 61 20 63 6f 75 | Let's a|dd a cou|
|000012f0| 6e 74 65 72 20 61 6e 64 | 20 61 63 63 75 6d 75 6c |nter and| accumul|
|00001300| 61 74 6f 72 20 74 6f 20 | 6f 75 72 20 73 61 6d 70 |ator to |our samp|
|00001310| 6c 65 20 70 72 6f 67 72 | 61 6d 20 66 72 6f 6d 20 |le progr|am from |
|00001320| 74 68 65 0d 0a 20 20 20 | 20 20 70 72 65 76 69 6f |the.. | previo|
|00001330| 75 73 20 63 68 61 70 74 | 65 72 20 61 6e 64 20 61 |us chapt|er and a|
|00001340| 63 63 75 6d 75 6c 61 74 | 65 20 74 68 65 20 73 75 |ccumulat|e the su|
|00001350| 6d 20 6f 66 20 61 6c 6c | 20 74 68 65 20 62 69 6c |m of all| the bil|
|00001360| 6c 73 20 28 77 65 27 6c | 6c 20 63 61 6c 6c 20 69 |ls (we'l|l call i|
|00001370| 74 0d 0a 20 20 20 20 20 | 54 4f 54 2e 42 49 4c 4c |t.. |TOT.BILL|
|00001380| 29 2e 20 20 57 65 20 77 | 69 6c 6c 20 61 6c 73 6f |). We w|ill also|
|00001390| 20 63 6f 75 6e 74 20 68 | 6f 77 20 6d 61 6e 79 20 | count h|ow many |
|000013a0| 64 69 66 66 65 72 65 6e | 74 20 64 65 70 61 72 74 |differen|t depart|
|000013b0| 6d 65 6e 74 73 20 77 65 | 20 61 72 65 0d 0a 20 20 |ments we| are.. |
|000013c0| 20 20 20 62 69 6c 6c 69 | 6e 67 20 28 54 4f 54 2e | billi|ng (TOT.|
|000013d0| 44 45 50 54 53 29 2e 0d | 0a 0d 0a 20 20 20 20 20 |DEPTS)..|... |
|000013e0| 31 30 30 20 27 20 20 20 | 50 52 4f 47 52 41 4d 20 |100 ' |PROGRAM |
|000013f0| 4e 41 4d 45 3a 20 50 48 | 4f 4e 45 42 49 4c 0d 0a |NAME: PH|ONEBIL..|
|00001400| 20 20 20 20 20 31 31 30 | 20 27 20 20 20 57 52 49 | 110| ' WRI|
|00001410| 54 54 45 4e 20 42 59 3a | 20 20 20 54 2e 20 41 55 |TTEN BY:| T. AU|
|00001420| 54 48 4f 52 0d 0a 20 20 | 20 20 20 31 32 30 20 27 |THOR.. | 120 '|
|00001430| 20 20 20 44 41 54 45 20 | 20 20 20 20 20 3a 20 20 | DATE | : |
|00001440| 20 31 30 2f 31 30 2f 37 | 39 0d 0a 20 20 20 20 20 | 10/10/7|9.. |
|00001450| 31 33 30 20 27 0d 0a 20 | 20 20 20 20 31 34 30 20 |130 '.. | 140 |
|00001460| 27 20 20 20 54 48 49 53 | 20 50 52 4f 47 52 41 4d |' THIS| PROGRAM|
|00001470| 20 50 52 4f 44 55 43 45 | 53 20 41 20 54 45 4c 45 | PRODUCE|S A TELE|
|00001480| 50 48 4f 4e 45 20 42 49 | 4c 4c 20 42 59 20 44 45 |PHONE BI|LL BY DE|
|00001490| 50 41 52 54 4d 45 4e 54 | 20 43 41 4c 43 55 4c 41 |PARTMENT| CALCULA|
|000014a0| 54 49 4e 47 0d 0a 20 20 | 20 20 20 31 35 30 20 27 |TING.. | 150 '|
|000014b0| 20 20 20 54 48 45 20 41 | 43 54 55 41 4c 20 43 48 | THE A|CTUAL CH|
|000014c0| 41 52 47 45 20 42 59 20 | 4d 55 4c 54 49 50 4c 59 |ARGE BY |MULTIPLY|
|000014d0| 49 4e 47 20 54 48 45 20 | 4e 55 4d 42 45 52 20 4f |ING THE |NUMBER O|
|000014e0| 46 20 50 48 4f 4e 45 53 | 20 49 4e 20 45 41 43 48 |F PHONES| IN EACH|
|000014f0| 0d 0a 20 20 20 20 20 31 | 36 30 20 27 20 20 20 44 |.. 1|60 ' D|
|00001500| 45 50 41 52 54 4d 45 4e | 54 20 42 59 20 54 48 45 |EPARTMEN|T BY THE|
|00001510| 20 43 55 52 52 45 4e 54 | 20 52 41 54 45 20 50 45 | CURRENT| RATE PE|
|00001520| 52 20 50 48 4f 4e 45 0d | 0a 20 20 20 20 20 31 37 |R PHONE.|. 17|
|00001530| 30 20 27 0d 0a 20 20 20 | 20 20 31 38 30 20 27 20 |0 '.. | 180 ' |
|00001540| 20 20 49 4e 50 55 54 20 | 56 41 52 49 41 42 4c 45 | INPUT |VARIABLE|
|00001550| 20 4e 41 4d 45 53 20 41 | 52 45 3a 0d 0a 20 20 20 | NAMES A|RE:.. |
|00001560| 20 20 31 39 30 20 27 0d | 0a 20 20 20 20 20 32 30 | 190 '.|. 20|
|00001570| 30 20 27 20 20 20 44 45 | 50 54 24 2e 2e 2e 2e 2e |0 ' DE|PT$.....|
|00001580| 2e 2e 2e 2e 44 45 50 41 | 52 54 4d 45 4e 54 20 4e |....DEPA|RTMENT N|
|00001590| 41 4d 45 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 20 20 |AME.....|. |
|000015a0| 20 20 20 20 20 20 20 20 | 20 20 1b 45 20 20 20 20 | | .E |
|000015b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 46 20 20 | | .F |
|000015c0| 20 20 20 1b 45 20 20 32 | 34 0d 0a 0d 0a 0c 0d 0a | .E 2|4.......|
|000015d0| 0d 0a 0d 0a 0d 0a 1b 46 | 20 20 20 20 20 1b 45 43 |.......F| .EC|
|000015e0| 48 41 50 54 45 52 20 33 | 1b 46 20 20 20 20 20 20 |HAPTER 3|.F |
|000015f0| 20 20 20 20 20 20 20 20 | 1b 45 20 43 4c 45 41 4e | |.E CLEAN|
|00001600| 49 4e 47 20 55 50 20 54 | 48 45 20 41 43 54 1b 46 |ING UP T|HE ACT.F|
|00001610| 20 1b 45 20 20 20 1b 46 | 20 20 20 20 20 20 20 20 | .E .F| |
|00001620| 20 20 20 20 20 20 20 20 | 1b 45 43 48 41 50 54 45 | |.ECHAPTE|
|00001630| 52 20 33 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 1b 46 |R 3.....|. .F|
|00001640| 32 31 30 20 27 20 20 20 | 41 43 43 54 2e 4e 55 4d |210 ' |ACCT.NUM|
|00001650| 2e 2e 2e 2e 2e 2e 44 45 | 50 41 52 54 4d 45 4e 54 |......DE|PARTMENT|
|00001660| 20 41 43 43 4f 55 4e 54 | 20 4e 55 4d 42 45 52 0d | ACCOUNT| NUMBER.|
|00001670| 0a 20 20 20 20 20 32 32 | 30 20 27 20 20 20 50 48 |. 22|0 ' PH|
|00001680| 4f 4e 45 53 2e 2e 2e 2e | 2e 2e 2e 2e 54 48 45 20 |ONES....|....THE |
|00001690| 54 4f 54 41 4c 20 4e 55 | 4d 42 45 52 20 4f 46 20 |TOTAL NU|MBER OF |
|000016a0| 54 45 4c 45 50 48 4f 4e | 45 53 20 49 4e 20 54 48 |TELEPHON|ES IN TH|
|000016b0| 45 20 44 45 50 54 2e 0d | 0a 20 20 20 20 20 32 33 |E DEPT..|. 23|
|000016c0| 30 20 27 0d 0a 20 20 20 | 20 20 32 34 30 20 27 20 |0 '.. | 240 ' |
|000016d0| 20 20 4f 54 48 45 52 20 | 56 41 52 49 41 42 4c 45 | OTHER |VARIABLE|
|000016e0| 53 20 41 4e 44 20 43 4f | 4e 53 54 41 4e 54 53 20 |S AND CO|NSTANTS |
|000016f0| 41 52 45 3a 0d 0a 20 20 | 20 20 20 32 35 30 20 27 |ARE:.. | 250 '|
|00001700| 0d 0a 20 20 20 20 20 32 | 36 30 20 27 20 20 20 52 |.. 2|60 ' R|
|00001710| 41 54 45 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 54 48 45 |ATE.....|.....THE|
|00001720| 20 43 55 52 52 45 4e 54 | 20 4d 4f 4e 54 48 4c 59 | CURRENT| MONTHLY|
|00001730| 20 52 41 54 45 20 50 45 | 52 20 50 48 4f 4e 45 2c | RATE PE|R PHONE,|
|00001740| 20 41 20 43 4f 4e 53 54 | 41 4e 54 0d 0a 20 20 20 | A CONST|ANT.. |
|00001750| 20 20 32 37 30 20 27 20 | 20 20 43 48 41 52 47 45 | 270 ' | CHARGE|
|00001760| 2e 2e 2e 2e 2e 2e 2e 2e | 54 4f 54 41 4c 20 43 48 |........|TOTAL CH|
|00001770| 41 52 47 45 20 46 4f 52 | 20 54 48 45 20 44 45 50 |ARGE FOR| THE DEP|
|00001780| 41 52 54 4d 45 4e 54 2c | 20 43 41 4c 43 55 4c 41 |ARTMENT,| CALCULA|
|00001790| 54 45 44 0d 0a 20 20 20 | 20 20 32 37 33 20 27 20 |TED.. | 273 ' |
|000017a0| 20 20 54 4f 54 2e 42 49 | 4c 4c 2e 2e 2e 2e 2e 2e | TOT.BI|LL......|
|000017b0| 41 43 43 55 4d 55 4c 41 | 54 4f 52 20 46 4f 52 20 |ACCUMULA|TOR FOR |
|000017c0| 54 4f 54 41 4c 20 41 4d | 4f 55 4e 54 20 42 49 4c |TOTAL AM|OUNT BIL|
|000017d0| 4c 45 44 0d 0a 20 20 20 | 20 20 32 37 35 20 27 20 |LED.. | 275 ' |
|000017e0| 20 20 54 4f 54 2e 44 45 | 50 54 53 2e 2e 2e 2e 2e | TOT.DE|PTS.....|
|000017f0| 43 4f 55 4e 54 45 52 20 | 46 4f 52 20 54 4f 54 41 |COUNTER |FOR TOTA|
|00001800| 4c 20 4e 4f 2e 20 4f 46 | 20 44 45 50 54 53 20 42 |L NO. OF| DEPTS B|
|00001810| 49 4c 4c 45 44 2c 0d 0a | 20 20 20 20 20 32 38 30 |ILLED,..| 280|
|00001820| 20 27 0d 0a 20 20 20 20 | 20 32 39 30 20 27 20 20 | '.. | 290 ' |
|00001830| 20 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 20 20 20 20 44 | *******|*** D|
|00001840| 45 46 49 4e 49 54 49 4f | 4e 20 4f 46 20 43 4f 4e |EFINITIO|N OF CON|
|00001850| 53 54 41 4e 54 53 20 20 | 20 20 2a 2a 2a 2a 2a 2a |STANTS | ******|
|00001860| 2a 2a 2a 2a 0d 0a 20 20 | 20 20 20 33 30 30 20 27 |****.. | 300 '|
|00001870| 0d 0a 20 20 20 20 20 33 | 31 30 20 52 41 54 45 20 |.. 3|10 RATE |
|00001880| 20 20 20 20 20 3d 20 31 | 36 2e 32 35 0d 0a 20 20 | = 1|6.25.. |
|00001890| 20 20 20 33 31 35 20 46 | 4d 54 31 24 20 20 20 20 | 315 F|MT1$ |
|000018a0| 20 3d 20 22 3c 23 23 23 | 23 23 23 23 23 23 23 23 | = "<###|########|
|000018b0| 20 20 20 20 20 20 23 23 | 23 23 23 23 20 20 20 20 | ##|#### |
|000018c0| 20 20 20 20 20 20 23 23 | 20 20 20 20 20 20 20 20 | ##| |
|000018d0| 23 23 23 23 2e 23 23 22 | 0d 0a 20 20 20 20 20 33 |####.##"|.. 3|
|000018e0| 31 37 20 54 4f 54 2e 42 | 49 4c 4c 20 20 3d 20 30 |17 TOT.B|ILL = 0|
|000018f0| 0d 0a 20 20 20 20 20 33 | 31 38 20 54 4f 54 2e 44 |.. 3|18 TOT.D|
|00001900| 45 50 54 53 20 3d 20 30 | 0d 0a 20 20 20 20 20 33 |EPTS = 0|.. 3|
|00001910| 32 30 20 27 0d 0a 0d 0a | 20 20 20 20 20 4c 69 6e |20 '....| Lin|
|00001920| 65 73 20 33 31 37 20 61 | 6e 64 20 33 31 38 20 69 |es 317 a|nd 318 i|
|00001930| 6e 69 74 69 61 6c 69 7a | 65 20 6f 75 72 20 63 6f |nitializ|e our co|
|00001940| 75 6e 74 65 72 20 61 6e | 64 20 61 63 63 75 6d 75 |unter an|d accumu|
|00001950| 6c 61 74 6f 72 20 69 6e | 73 75 72 69 6e 67 20 74 |lator in|suring t|
|00001960| 68 61 74 0d 0a 20 20 20 | 20 20 74 68 65 73 65 20 |hat.. | these |
|00001970| 73 74 61 72 74 20 61 74 | 20 30 2e 20 20 54 68 65 |start at| 0. The|
|00001980| 20 66 75 6e 63 74 69 6f | 6e 20 6f 66 20 74 68 65 | functio|n of the|
|00001990| 73 65 20 76 61 72 69 61 | 62 6c 65 73 20 69 73 20 |se varia|bles is |
|000019a0| 65 78 70 6c 61 69 6e 65 | 64 20 6f 6e 20 6c 69 6e |explaine|d on lin|
|000019b0| 65 0d 0a 20 20 20 20 20 | 32 37 33 20 61 6e 64 20 |e.. |273 and |
|000019c0| 6c 69 6e 65 20 32 37 35 | 2e 0d 0a 0d 0a 20 20 20 |line 275|..... |
|000019d0| 20 20 4c 61 73 74 20 62 | 75 74 20 6e 6f 74 20 6c | Last b|ut not l|
|000019e0| 65 61 73 74 2c 20 69 66 | 20 79 6f 75 20 6c 6f 6f |east, if| you loo|
|000019f0| 6b 20 61 74 20 6c 69 6e | 65 73 20 33 31 30 20 74 |k at lin|es 310 t|
|00001a00| 68 72 6f 75 67 68 20 33 | 31 38 20 79 6f 75 27 6c |hrough 3|18 you'l|
|00001a10| 6c 20 73 65 65 20 74 68 | 61 74 0d 0a 20 20 20 20 |l see th|at.. |
|00001a20| 20 65 76 65 72 79 74 68 | 69 6e 67 20 69 73 20 6c | everyth|ing is l|
|00001a30| 69 6e 65 64 20 75 70 20 | 6f 6e 20 74 68 65 20 3d |ined up |on the =|
|00001a40| 20 73 69 67 6e 73 2e 20 | 20 49 74 20 64 6f 65 73 | signs. | It does|
|00001a50| 6e 27 74 20 6c 6f 6f 6b | 20 6c 69 6b 65 20 74 68 |n't look| like th|
|00001a60| 61 74 20 6d 75 63 68 0d | 0a 20 20 20 20 20 62 75 |at much.|. bu|
|00001a70| 74 20 69 74 20 64 6f 65 | 73 20 6d 61 6b 65 20 69 |t it doe|s make i|
|00001a80| 74 20 65 61 73 69 65 72 | 20 74 6f 20 72 65 61 64 |t easier| to read|
|00001a90| 2e 20 20 43 6f 6d 70 61 | 72 65 20 74 68 65 73 65 |. Compa|re these|
|00001aa0| 20 74 6f 20 74 68 65 20 | 63 6f 6d 70 72 65 73 73 | to the |compress|
|00001ab0| 65 64 0d 0a 20 20 20 20 | 20 76 65 72 73 69 6f 6e |ed.. | version|
|00001ac0| 73 20 6f 66 20 74 68 65 | 20 73 61 6d 65 20 6c 69 |s of the| same li|
|00001ad0| 6e 65 20 6e 75 6d 62 65 | 72 73 20 73 68 6f 77 6e |ne numbe|rs shown|
|00001ae0| 20 62 65 6c 6f 77 3a 0d | 0a 0d 0a 20 20 20 20 20 | below:.|... |
|00001af0| 33 31 30 20 52 41 54 45 | 3d 31 36 2e 32 35 0d 0a |310 RATE|=16.25..|
|00001b00| 20 20 20 20 20 33 31 35 | 20 46 4d 54 31 24 3d 22 | 315| FMT1$="|
|00001b10| 3c 23 23 23 23 23 23 23 | 23 23 23 23 20 20 20 20 |<#######|#### |
|00001b20| 20 20 23 23 23 23 23 23 | 20 20 20 20 20 20 20 20 | ######| |
|00001b30| 20 20 23 23 20 20 20 20 | 20 20 20 20 23 23 23 23 | ## | ####|
|00001b40| 2e 23 23 22 0d 0a 20 20 | 20 20 20 33 31 37 20 54 |.##".. | 317 T|
|00001b50| 4f 54 2e 42 49 4c 4c 3d | 30 0d 0a 20 20 20 20 20 |OT.BILL=|0.. |
|00001b60| 33 31 38 20 54 4f 54 2e | 44 45 50 54 53 3d 30 0d |318 TOT.|DEPTS=0.|
|00001b70| 0a 20 20 20 20 20 33 32 | 30 20 27 0d 0a 0d 0a 20 |. 32|0 '.... |
|00001b80| 20 20 20 20 54 68 69 6e | 6b 20 6f 66 20 68 6f 77 | Thin|k of how|
|00001b90| 20 74 68 65 20 61 62 6f | 76 65 20 63 6f 64 65 20 | the abo|ve code |
|00001ba0| 77 6f 75 6c 64 20 61 70 | 70 65 61 72 20 61 74 20 |would ap|pear at |
|00001bb0| 74 68 72 65 65 20 69 6e | 20 74 68 65 20 6d 6f 72 |three in| the mor|
|00001bc0| 6e 69 6e 67 20 77 68 65 | 6e 0d 0a 20 20 20 20 20 |ning whe|n.. |
|00001bd0| 79 6f 75 27 72 65 20 73 | 74 61 72 69 6e 67 20 61 |you're s|taring a|
|00001be0| 74 20 69 74 20 74 68 72 | 6f 75 67 68 20 62 6c 6f |t it thr|ough blo|
|00001bf0| 6f 64 73 68 6f 74 20 65 | 79 65 73 2c 20 74 68 65 |odshot e|yes, the|
|00001c00| 6e 20 65 78 70 61 6e 64 | 20 79 6f 75 72 20 76 69 |n expand| your vi|
|00001c10| 73 69 6f 6e 20 74 6f 0d | 0a 20 20 20 20 20 69 6e |sion to.|. in|
|00001c20| 63 6c 75 64 65 20 61 20 | 77 68 6f 6c 65 20 70 72 |clude a |whole pr|
|00001c30| 6f 67 72 61 6d 20 69 6e | 73 74 65 61 64 20 6f 66 |ogram in|stead of|
|00001c40| 20 66 6f 75 72 20 6c 69 | 6e 65 73 2e 20 20 54 68 | four li|nes. Th|
|00001c50| 65 20 6d 65 73 73 61 67 | 65 20 69 73 20 74 68 61 |e messag|e is tha|
|00001c60| 74 20 61 0d 0a 20 20 20 | 20 20 67 6f 6f 64 20 70 |t a.. | good p|
|00001c70| 72 6f 67 72 61 6d 20 69 | 73 20 63 72 65 61 74 65 |rogram i|s create|
|00001c80| 64 20 74 68 72 6f 75 67 | 68 20 61 20 6c 6f 74 20 |d throug|h a lot |
|00001c90| 6f 66 20 73 6d 61 6c 6c | 2c 20 69 6e 63 72 65 6d |of small|, increm|
|00001ca0| 65 6e 74 61 6c 20 69 6d | 70 72 6f 76 65 6d 65 6e |ental im|provemen|
|00001cb0| 74 73 0d 0a 20 20 20 20 | 20 61 6e 64 20 6e 6f 74 |ts.. | and not|
|00001cc0| 20 6e 65 63 65 73 73 61 | 72 69 6c 79 20 62 79 20 | necessa|rily by |
|00001cd0| 61 6e 79 20 66 61 6e 74 | 61 73 74 69 63 20 64 65 |any fant|astic de|
|00001ce0| 73 69 67 6e 20 61 6e 64 | 20 61 6e 61 6c 79 73 69 |sign and| analysi|
|00001cf0| 73 2e 0d 0a 0d 0a 20 20 | 20 20 20 4c 65 74 27 73 |s..... | Let's|
|00001d00| 20 70 72 6f 63 65 65 64 | 20 77 69 74 68 20 74 68 | proceed| with th|
|00001d10| 65 20 72 65 73 74 20 6f | 66 20 6f 75 72 20 75 70 |e rest o|f our up|
|00001d20| 67 72 61 64 65 20 28 77 | 6f 77 2c 20 79 6f 75 27 |grade (w|ow, you'|
|00001d30| 76 65 20 61 6c 72 65 61 | 64 79 0d 0a 20 20 20 20 |ve alrea|dy.. |
|00001d40| 20 67 72 61 64 75 61 74 | 65 64 20 74 6f 20 62 65 | graduat|ed to be|
|00001d50| 69 6e 67 20 61 20 6d 61 | 69 6e 74 65 6e 61 6e 63 |ing a ma|intenanc|
|00001d60| 65 20 70 72 6f 67 72 61 | 6d 6d 65 72 29 2e 20 20 |e progra|mmer). |
|00001d70| 54 68 65 20 61 63 63 75 | 6d 75 6c 61 74 6f 72 20 |The accu|mulator |
|00001d80| 61 6e 64 0d 0a 20 20 20 | 20 20 63 6f 75 6e 74 65 |and.. | counte|
|00001d90| 72 20 67 6f 20 69 6e 20 | 6f 75 72 20 6d 61 69 6e |r go in |our main|
|00001da0| 20 70 72 6f 63 65 73 73 | 69 6e 67 20 6c 6f 6f 70 | process|ing loop|
|00001db0| 2e 20 20 49 66 20 79 6f | 75 20 63 68 65 63 6b 20 |. If yo|u check |
|00001dc0| 6f 75 74 20 6c 69 6e 65 | 73 20 34 35 35 20 61 6e |out line|s 455 an|
|00001dd0| 64 0d 0a 20 20 20 20 20 | 34 35 37 20 79 6f 75 20 |d.. |457 you |
|00001de0| 63 61 6e 20 73 65 65 20 | 54 4f 54 2e 42 49 4c 4c |can see |TOT.BILL|
|00001df0| 20 61 6e 64 20 54 4f 54 | 2e 44 45 50 54 53 20 74 | and TOT|.DEPTS t|
|00001e00| 68 65 72 65 20 72 65 61 | 64 79 20 74 6f 20 64 6f |here rea|dy to do|
|00001e10| 20 69 74 20 74 6f 20 69 | 74 2e 0d 0a 0d 0a 20 20 | it to i|t..... |
|00001e20| 20 20 20 33 33 30 20 27 | 20 20 20 2a 2a 2a 2a 2a | 330 '| *****|
|00001e30| 2a 2a 2a 2a 2a 20 20 20 | 20 50 52 4f 43 45 53 53 |***** | PROCESS|
|00001e40| 49 4e 47 20 20 20 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |ING *|********|
|00001e50| 2a 2a 0d 0a 20 20 20 20 | 20 33 34 30 20 27 0d 0a |**.. | 340 '..|
|00001e60| 20 20 20 20 20 33 35 30 | 20 50 52 49 4e 54 0d 0a | 350| PRINT..|
|00001e70| 20 20 20 20 20 33 36 30 | 20 50 52 49 4e 54 20 22 | 360| PRINT "|
|00001e80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 44 45 50 | | DEP|
|00001e90| 41 52 54 4d 45 4e 54 20 | 50 48 4f 4e 45 20 42 49 |ARTMENT |PHONE BI|
|00001ea0| 4c 4c 49 4e 47 22 0d 0a | 20 20 20 20 20 33 37 30 |LLING"..| 370|
|00001eb0| 20 50 52 49 4e 54 20 22 | 20 20 20 20 20 20 20 20 | PRINT "| |
|00001ec0| 20 20 20 20 20 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d | ===|========|
|00001ed0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 22 0d 0a |========|====="..|
|00001ee0| 20 20 20 20 20 33 38 30 | 20 50 52 49 4e 54 0d 0a | 380| PRINT..|
|00001ef0| 20 20 20 20 20 33 39 30 | 20 50 52 49 4e 54 0d 0a | 390| PRINT..|
|00001f00| 20 20 20 20 20 34 30 30 | 20 50 52 49 4e 54 22 44 | 400| PRINT"D|
|00001f10| 45 50 41 52 54 4d 45 4e | 54 20 20 20 20 20 20 41 |EPARTMEN|T A|
|00001f20| 43 43 4f 55 4e 54 20 20 | 20 20 20 20 20 50 48 4f |CCOUNT | PHO|
|00001f30| 4e 45 53 20 20 20 20 20 | 20 43 48 41 52 47 45 22 |NES | CHARGE"|
|00001f40| 0d 0a 20 20 20 20 20 34 | 31 30 20 50 52 49 4e 54 |.. 4|10 PRINT|
|00001f50| 22 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 20 20 20 20 20 |"-------|--- |
|00001f60| 20 2d 2d 2d 2d 2d 2d 2d | 20 20 20 20 20 20 20 2d | -------| -|
|00001f70| 2d 2d 2d 2d 2d 20 20 20 | 20 20 20 2d 2d 2d 2d 2d |----- | -----|
|00001f80| 2d 22 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 20 20 20 |-"......| |
|00001f90| 20 20 20 20 20 20 20 20 | 20 1b 45 20 20 20 20 20 | | .E |
|00001fa0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 46 20 20 20 | | .F |
|00001fb0| 20 20 1b 45 20 20 32 35 | 0d 0a 0d 0a 0c 0d 0a 0d | .E 25|........|
|00001fc0| 0a 0d 0a 0d 0a 1b 46 20 | 20 20 20 20 1b 45 43 48 |......F | .ECH|
|00001fd0| 41 50 54 45 52 20 33 1b | 46 20 20 20 20 20 20 20 |APTER 3.|F |
|00001fe0| 20 20 20 20 20 20 20 1b | 45 20 43 4c 45 41 4e 49 | .|E CLEANI|
|00001ff0| 4e 47 20 55 50 20 54 48 | 45 20 41 43 54 1b 46 20 |NG UP TH|E ACT.F |
|00002000| 1b 45 20 20 20 1b 46 20 | 20 20 20 20 20 20 20 20 |.E .F | |
|00002010| 20 20 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 | .|ECHAPTER|
|00002020| 20 33 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 1b 46 34 | 3......| .F4|
|00002030| 32 30 20 50 52 49 4e 54 | 0d 0a 20 20 20 20 20 34 |20 PRINT|.. 4|
|00002040| 32 35 20 27 0d 0a 20 20 | 20 20 20 34 33 30 20 52 |25 '.. | 430 R|
|00002050| 45 41 44 20 44 45 50 54 | 24 2c 20 41 43 43 54 2e |EAD DEPT|$, ACCT.|
|00002060| 4e 55 4d 2c 20 50 48 4f | 4e 45 53 0d 0a 20 20 20 |NUM, PHO|NES.. |
|00002070| 20 20 34 33 35 20 27 0d | 0a 20 20 20 20 20 34 34 | 435 '.|. 44|
|00002080| 30 20 57 48 49 4c 45 20 | 44 45 50 54 24 20 3c 3e |0 WHILE |DEPT$ <>|
|00002090| 20 22 45 4f 46 22 0d 0a | 20 20 20 20 20 34 34 35 | "EOF"..| 445|
|000020a0| 20 27 0d 0a 20 20 20 20 | 20 34 35 30 20 20 20 20 | '.. | 450 |
|000020b0| 43 48 41 52 47 45 20 20 | 20 20 3d 20 50 48 4f 4e |CHARGE | = PHON|
|000020c0| 45 53 20 2a 20 52 41 54 | 45 0d 0a 20 20 20 20 20 |ES * RAT|E.. |
|000020d0| 34 35 35 20 20 20 20 54 | 4f 54 2e 42 49 4c 4c 20 |455 T|OT.BILL |
|000020e0| 20 3d 20 54 4f 54 2e 42 | 49 4c 4c 20 2b 20 43 48 | = TOT.B|ILL + CH|
|000020f0| 41 52 47 45 0d 0a 20 20 | 20 20 20 34 35 37 20 20 |ARGE.. | 457 |
|00002100| 20 20 54 4f 54 2e 44 45 | 50 54 53 20 3d 20 54 4f | TOT.DE|PTS = TO|
|00002110| 54 2e 44 45 50 54 53 20 | 2b 20 31 0d 0a 20 20 20 |T.DEPTS |+ 1.. |
|00002120| 20 20 34 35 38 20 27 0d | 0a 20 20 20 20 20 34 36 | 458 '.|. 46|
|00002130| 30 20 20 20 20 50 52 49 | 4e 54 20 55 53 49 4e 47 |0 PRI|NT USING|
|00002140| 20 46 4d 54 31 24 3b 20 | 44 45 50 54 24 2c 20 41 | FMT1$; |DEPT$, A|
|00002150| 43 43 54 2e 4e 55 4d 2c | 20 50 48 4f 4e 45 53 2c |CCT.NUM,| PHONES,|
|00002160| 20 52 41 54 45 0d 0a 20 | 20 20 20 20 34 37 30 20 | RATE.. | 470 |
|00002170| 20 20 20 52 45 41 44 20 | 44 45 50 54 24 2c 20 41 | READ |DEPT$, A|
|00002180| 43 43 54 2e 4e 55 4d 2c | 20 50 48 4f 4e 45 53 0d |CCT.NUM,| PHONES.|
|00002190| 0a 20 20 20 20 20 34 37 | 35 20 27 0d 0a 20 20 20 |. 47|5 '.. |
|000021a0| 20 20 34 38 30 20 57 45 | 4e 44 0d 0a 0d 0a 20 20 | 480 WE|ND.... |
|000021b0| 20 20 20 4f 6e 63 65 20 | 74 68 65 20 6c 6f 6f 70 | Once |the loop|
|000021c0| 20 69 73 20 66 69 6e 69 | 73 68 65 64 2c 20 74 68 | is fini|shed, th|
|000021d0| 65 20 57 48 49 4c 45 20 | 74 72 61 6e 73 66 65 72 |e WHILE |transfer|
|000021e0| 73 20 63 6f 6e 74 72 6f | 6c 20 74 6f 20 6c 69 6e |s contro|l to lin|
|000021f0| 65 20 34 39 30 20 61 6e | 64 0d 0a 20 20 20 20 20 |e 490 an|d.. |
|00002200| 74 68 65 20 50 52 49 4e | 54 20 73 74 61 74 65 6d |the PRIN|T statem|
|00002210| 65 6e 74 73 20 73 68 6f | 77 6e 20 62 65 6c 6f 77 |ents sho|wn below|
|00002220| 20 61 72 65 20 65 78 65 | 63 75 74 65 64 3a 0d 0a | are exe|cuted:..|
|00002230| 0d 0a 20 20 20 20 20 34 | 39 30 20 50 52 49 4e 54 |.. 4|90 PRINT|
|00002240| 0d 0a 20 20 20 20 20 35 | 30 30 20 50 52 49 4e 54 |.. 5|00 PRINT|
|00002250| 20 22 54 4f 54 41 4c 20 | 4e 55 4d 42 45 52 20 4f | "TOTAL |NUMBER O|
|00002260| 46 20 44 45 50 54 53 3a | 20 20 20 20 20 22 3b 54 |F DEPTS:| ";T|
|00002270| 4f 54 2e 44 45 50 54 53 | 0d 0a 20 20 20 20 20 35 |OT.DEPTS|.. 5|
|00002280| 31 30 20 50 52 49 4e 54 | 20 22 54 4f 54 41 4c 20 |10 PRINT| "TOTAL |
|00002290| 42 49 4c 4c 20 46 4f 52 | 20 41 4c 4c 20 44 45 50 |BILL FOR| ALL DEP|
|000022a0| 54 53 3a 20 20 22 3b 54 | 4f 54 2e 42 49 4c 4c 0d |TS: ";T|OT.BILL.|
|000022b0| 0a 20 20 20 20 20 35 32 | 30 20 27 0d 0a 20 20 20 |. 52|0 '.. |
|000022c0| 20 20 35 33 30 20 27 20 | 20 2a 2a 2a 2a 2a 2a 2a | 530 ' | *******|
|000022d0| 2a 2a 2a 2a 2a 20 20 20 | 20 49 4e 50 55 54 20 44 |***** | INPUT D|
|000022e0| 41 54 41 20 20 20 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |ATA *|********|
|000022f0| 2a 2a 2a 0d 0a 20 20 20 | 20 20 35 34 30 20 27 0d |***.. | 540 '.|
|00002300| 0a 20 20 20 20 20 35 35 | 30 20 44 41 54 41 20 52 |. 55|0 DATA R|
|00002310| 45 43 45 49 56 49 4e 47 | 2c 31 32 33 30 30 32 2c |ECEIVING|,123002,|
|00002320| 33 0d 0a 20 20 20 20 20 | 35 36 30 20 44 41 54 41 |3.. |560 DATA|
|00002330| 20 4d 41 52 4b 45 54 49 | 4e 47 2c 37 33 34 30 30 | MARKETI|NG,73400|
|00002340| 31 2c 38 0d 0a 20 20 20 | 20 20 35 37 30 20 44 41 |1,8.. | 570 DA|
|00002350| 54 41 20 50 45 52 53 4f | 4e 4e 45 4c 2c 39 39 31 |TA PERSO|NNEL,991|
|00002360| 30 32 34 2c 37 0d 0a 20 | 20 20 20 20 35 38 30 20 |024,7.. | 580 |
|00002370| 44 41 54 41 20 43 4f 4d | 50 55 54 49 4e 47 2c 39 |DATA COM|PUTING,9|
|00002380| 39 39 39 39 38 2c 31 0d | 0a 20 20 20 20 20 35 39 |99998,1.|. 59|
|00002390| 30 20 44 41 54 41 20 45 | 4f 46 2c 30 2c 30 0d 0a |0 DATA E|OF,0,0..|
|000023a0| 20 20 20 20 20 36 30 30 | 20 53 54 4f 50 0d 0a 20 | 600| STOP.. |
|000023b0| 20 20 20 20 36 31 30 20 | 45 4e 44 0d 0a 0d 0a 20 | 610 |END.... |
|000023c0| 20 20 20 20 41 63 63 75 | 6d 75 6c 61 74 6f 72 73 | Accu|mulators|
|000023d0| 20 61 6e 64 20 63 6f 75 | 6e 74 65 72 73 20 61 72 | and cou|nters ar|
|000023e0| 65 20 63 75 6d 75 6c 61 | 74 69 76 65 2e 20 20 49 |e cumula|tive. I|
|000023f0| 66 20 74 68 65 79 20 61 | 72 65 20 6e 6f 74 20 69 |f they a|re not i|
|00002400| 6e 69 74 69 61 6c 69 7a | 65 64 0d 0a 20 20 20 20 |nitializ|ed.. |
|00002410| 20 74 68 65 20 74 6f 74 | 61 6c 20 77 69 6c 6c 20 | the tot|al will |
|00002420| 62 65 20 69 6e 63 6f 72 | 72 65 63 74 2e 20 20 54 |be incor|rect. T|
|00002430| 68 69 73 20 69 73 20 74 | 68 65 20 6d 61 6a 6f 72 |his is t|he major|
|00002440| 20 64 69 66 66 65 72 65 | 6e 63 65 20 62 65 74 77 | differe|nce betw|
|00002450| 65 65 6e 0d 0a 20 20 20 | 20 20 61 63 63 75 6d 75 |een.. | accumu|
|00002460| 6c 61 74 6f 72 73 20 61 | 6e 64 20 63 6f 75 6e 74 |lators a|nd count|
|00002470| 65 72 73 2c 20 61 6e 64 | 20 6f 74 68 65 72 20 76 |ers, and| other v|
|00002480| 61 72 69 61 62 6c 65 73 | 2e 20 20 54 68 65 20 6c |ariables|. The l|
|00002490| 61 74 74 65 72 20 61 72 | 65 20 6e 6f 74 0d 0a 20 |atter ar|e not.. |
|000024a0| 20 20 20 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 2e | init|ialized.|
|000024b0| 0d 0a 0d 0a 20 20 20 20 | 20 41 6e 6f 74 68 65 72 |.... | Another|
|000024c0| 20 71 75 69 63 6b 20 6e | 6f 74 65 3a 20 20 4c 69 | quick n|ote: Li|
|000024d0| 6e 65 20 35 30 30 20 63 | 6f 75 6c 64 20 61 6c 73 |ne 500 c|ould als|
|000024e0| 6f 20 62 65 20 6f 75 74 | 70 75 74 20 75 73 69 6e |o be out|put usin|
|000024f0| 67 20 61 20 66 6f 72 6d | 61 74 0d 0a 20 20 20 20 |g a form|at.. |
|00002500| 20 73 74 61 74 65 6d 65 | 6e 74 20 77 69 74 68 20 | stateme|nt with |
|00002510| 61 20 50 52 49 4e 54 20 | 55 53 49 4e 47 2e 20 20 |a PRINT |USING. |
|00002520| 54 68 65 20 63 6f 64 65 | 20 77 6f 75 6c 64 20 6c |The code| would l|
|00002530| 6f 6f 6b 20 6c 69 6b 65 | 20 74 68 69 73 3a 0d 0a |ook like| this:..|
|00002540| 0d 0a 20 20 20 20 20 33 | 31 36 20 46 4d 54 32 24 |.. 3|16 FMT2$|
|00002550| 20 3d 20 22 54 4f 54 41 | 4c 20 4e 55 4d 42 45 52 | = "TOTA|L NUMBER|
|00002560| 20 4f 46 20 44 45 50 54 | 53 3a 20 20 20 20 20 20 | OF DEPT|S: |
|00002570| 20 20 20 23 23 23 23 22 | 0d 0a 20 20 20 20 20 35 | ####"|.. 5|
|00002580| 30 30 20 50 52 49 4e 54 | 20 55 53 49 4e 47 20 46 |00 PRINT| USING F|
|00002590| 4d 54 32 24 3b 20 54 4f | 54 2e 44 45 50 54 53 0d |MT2$; TO|T.DEPTS.|
|000025a0| 0a 0d 0a 0d 0a 20 20 20 | 20 20 1b 45 43 4f 4d 50 |..... | .ECOMP|
|000025b0| 41 52 49 4e 47 0d 0a 0d | 0a 20 20 20 20 20 1b 46 |ARING...|. .F|
|000025c0| 43 6f 6d 70 75 74 65 72 | 73 20 68 61 6e 64 6c 65 |Computer|s handle|
|000025d0| 20 6d 61 73 73 69 76 65 | 20 61 6d 6f 75 6e 74 73 | massive| amounts|
|000025e0| 20 6f 66 20 64 61 74 61 | 2e 20 20 41 73 20 6e 6f | of data|. As no|
|000025f0| 74 65 64 20 65 61 72 6c | 69 65 72 2c 20 74 68 65 |ted earl|ier, the|
|00002600| 69 72 20 61 64 75 6c 74 | 0d 0a 20 20 20 20 20 6c |ir adult|.. l|
|00002610| 69 76 65 73 20 28 77 68 | 65 6e 20 74 68 65 79 20 |ives (wh|en they |
|00002620| 68 61 76 65 20 65 61 74 | 65 6e 20 65 6e 6f 75 67 |have eat|en enoug|
|00002630| 68 20 69 6e 70 75 74 20 | 74 6f 20 67 72 6f 77 20 |h input |to grow |
|00002640| 66 72 6f 6d 20 61 20 50 | 43 20 74 6f 20 61 0d 0a |from a P|C to a..|
|00002650| 20 20 20 20 20 6d 61 69 | 6e 66 72 61 6d 65 29 20 | mai|nframe) |
|00002660| 61 72 65 20 73 70 65 6e | 74 20 63 6f 6d 70 61 72 |are spen|t compar|
|00002670| 69 6e 67 2e 20 20 48 65 | 6e 63 65 20 77 65 20 6e |ing. He|nce we n|
|00002680| 65 65 64 20 70 72 6f 67 | 72 61 6d 6d 69 6e 67 20 |eed prog|ramming |
|00002690| 74 6f 6f 6c 73 20 66 6f | 72 0d 0a 20 20 20 20 20 |tools fo|r.. |
|000026a0| 63 6f 6d 70 61 72 69 6e | 67 20 64 61 74 61 20 61 |comparin|g data a|
|000026b0| 6e 64 20 66 6f 72 20 70 | 65 72 66 6f 72 6d 69 6e |nd for p|erformin|
|000026c0| 67 20 6c 6f 67 69 63 20 | 61 73 20 61 20 66 75 6e |g logic |as a fun|
|000026d0| 63 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 72 65 73 |ction of| the res|
|000026e0| 75 6c 74 73 2e 0d 0a 20 | 20 20 20 20 4e 6f 74 20 |ults... | Not |
|000026f0| 73 75 72 70 72 69 73 69 | 6e 67 6c 79 2c 20 74 68 |surprisi|ngly, th|
|00002700| 69 73 20 69 73 20 64 6f | 6e 65 20 74 68 72 6f 75 |is is do|ne throu|
|00002710| 67 68 20 74 68 65 20 49 | 46 20 73 74 61 74 65 6d |gh the I|F statem|
|00002720| 65 6e 74 2e 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 20 20 |ent.....|...... |
|00002730| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|00002740| 45 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |E | |
|00002750| 20 1b 46 20 20 20 20 20 | 1b 45 20 20 32 36 0d 0a | .F |.E 26..|
|00002760| 0d 0a 0c 0d 0a 0d 0a 0d | 0a 0d 0a 1b 46 20 20 20 |........|....F |
|00002770| 20 20 1b 45 43 48 41 50 | 54 45 52 20 33 1b 46 20 | .ECHAP|TER 3.F |
|00002780| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 20 | | .E |
|00002790| 43 4c 45 41 4e 49 4e 47 | 20 55 50 20 54 48 45 20 |CLEANING| UP THE |
|000027a0| 41 43 54 1b 46 20 1b 45 | 20 20 20 1b 46 20 20 20 |ACT.F .E| .F |
|000027b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 43 | | .EC|
|000027c0| 48 41 50 54 45 52 20 33 | 0d 0a 0d 0a 0d 0a 20 20 |HAPTER 3|...... |
|000027d0| 20 20 20 1b 46 31 30 30 | 20 52 45 41 44 20 50 45 | .F100| READ PE|
|000027e0| 52 53 4f 4e 24 2c 20 48 | 45 49 47 48 54 0d 0a 20 |RSON$, H|EIGHT.. |
|000027f0| 20 20 20 20 31 30 35 20 | 27 0d 0a 20 20 20 20 20 | 105 |'.. |
|00002800| 31 31 30 20 57 48 49 4c | 45 20 50 45 52 53 4f 4e |110 WHIL|E PERSON|
|00002810| 24 20 3c 3e 20 22 46 49 | 4e 49 53 48 45 44 22 0d |$ <> "FI|NISHED".|
|00002820| 0a 20 20 20 20 20 31 31 | 35 20 27 0d 0a 20 20 20 |. 11|5 '.. |
|00002830| 20 20 31 32 30 20 20 20 | 20 50 52 49 4e 54 20 50 | 120 | PRINT P|
|00002840| 45 52 53 4f 4e 24 3b 0d | 0a 20 20 20 20 20 31 33 |ERSON$;.|. 13|
|00002850| 30 20 20 20 20 49 46 20 | 48 45 49 47 48 54 20 3e |0 IF |HEIGHT >|
|00002860| 20 36 20 54 48 45 4e 20 | 50 52 49 4e 54 20 22 20 | 6 THEN |PRINT " |
|00002870| 49 53 20 54 4f 4f 20 54 | 41 4c 4c 22 0d 0a 20 20 |IS TOO T|ALL".. |
|00002880| 20 20 20 31 34 30 20 20 | 20 20 49 46 20 48 45 49 | 140 | IF HEI|
|00002890| 47 48 54 20 3c 20 35 20 | 54 48 45 4e 20 50 52 49 |GHT < 5 |THEN PRI|
|000028a0| 4e 54 20 22 20 49 53 20 | 54 4f 4f 20 53 4d 41 4c |NT " IS |TOO SMAL|
|000028b0| 4c 22 0d 0a 20 20 20 20 | 20 31 35 30 20 20 20 20 |L".. | 150 |
|000028c0| 49 46 20 48 45 49 47 48 | 54 20 3e 3d 35 20 41 4e |IF HEIGH|T >=5 AN|
|000028d0| 44 20 48 45 49 47 48 54 | 20 3c 3d 20 36 20 54 48 |D HEIGHT| <= 6 TH|
|000028e0| 45 4e 20 50 52 49 4e 54 | 20 22 20 49 53 20 4e 4f |EN PRINT| " IS NO|
|000028f0| 54 20 42 41 44 20 41 54 | 20 41 4c 4c 22 0d 0a 20 |T BAD AT| ALL".. |
|00002900| 20 20 20 20 31 35 35 20 | 27 0d 0a 20 20 20 20 20 | 155 |'.. |
|00002910| 31 36 30 20 20 20 20 52 | 45 41 44 20 50 45 52 53 |160 R|EAD PERS|
|00002920| 4f 4e 24 2c 20 48 45 49 | 47 48 54 0d 0a 20 20 20 |ON$, HEI|GHT.. |
|00002930| 20 20 31 36 35 20 57 45 | 4e 44 0d 0a 20 20 20 20 | 165 WE|ND.. |
|00002940| 20 31 36 36 20 27 0d 0a | 20 20 20 20 20 31 37 30 | 166 '..| 170|
|00002950| 20 50 52 49 4e 54 0d 0a | 20 20 20 20 20 31 38 30 | PRINT..| 180|
|00002960| 20 27 0d 0a 20 20 20 20 | 20 31 39 30 20 27 20 20 | '.. | 190 ' |
|00002970| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 20 20 20 49 4e 50 |********|** INP|
|00002980| 55 54 20 44 41 54 41 20 | 20 20 2a 2a 2a 2a 2a 2a |UT DATA | ******|
|00002990| 2a 2a 2a 2a 0d 0a 20 20 | 20 20 20 32 30 30 20 27 |****.. | 200 '|
|000029a0| 0d 0a 20 20 20 20 20 32 | 31 30 20 44 41 54 41 20 |.. 2|10 DATA |
|000029b0| 54 4f 4d 2c 36 2e 31 0d | 0a 20 20 20 20 20 32 32 |TOM,6.1.|. 22|
|000029c0| 30 20 44 41 54 41 20 44 | 49 43 4b 2c 34 2e 35 0d |0 DATA D|ICK,4.5.|
|000029d0| 0a 20 20 20 20 20 32 33 | 30 20 44 41 54 41 20 48 |. 23|0 DATA H|
|000029e0| 41 52 52 59 2c 35 2e 31 | 0d 0a 20 20 20 20 20 32 |ARRY,5.1|.. 2|
|000029f0| 34 30 20 44 41 54 41 20 | 46 49 4e 49 53 48 45 44 |40 DATA |FINISHED|
|00002a00| 2c 30 2e 30 0d 0a 20 20 | 20 20 20 32 35 30 20 53 |,0.0.. | 250 S|
|00002a10| 54 4f 50 0d 0a 20 20 20 | 20 20 32 36 30 20 45 4e |TOP.. | 260 EN|
|00002a20| 44 0d 0a 0d 0a 20 20 20 | 20 20 45 6e 74 65 72 20 |D.... | Enter |
|00002a30| 61 6e 64 20 72 75 6e 20 | 74 68 65 20 61 62 6f 76 |and run |the abov|
|00002a40| 65 20 70 72 6f 67 72 61 | 6d 2e 20 20 59 6f 75 20 |e progra|m. You |
|00002a50| 77 69 6c 6c 20 67 65 74 | 20 61 20 67 6f 6f 64 20 |will get| a good |
|00002a60| 66 65 65 6c 20 66 6f 72 | 20 68 6f 77 20 74 68 65 |feel for| how the|
|00002a70| 0d 0a 20 20 20 20 20 49 | 46 2f 54 48 45 4e 20 77 |.. I|F/THEN w|
|00002a80| 6f 72 6b 73 2e 20 20 53 | 70 65 63 69 66 69 63 61 |orks. S|pecifica|
|00002a90| 6c 6c 79 2c 20 49 46 46 | 20 28 6d 61 74 68 65 6d |lly, IFF| (mathem|
|00002aa0| 61 74 69 63 61 6c 20 6e | 6f 74 61 74 69 6f 6e 20 |atical n|otation |
|00002ab0| 66 6f 72 20 69 66 20 61 | 6e 64 20 6f 6e 6c 79 0d |for if a|nd only.|
|00002ac0| 0a 20 20 20 20 20 69 66 | 2c 20 6e 6f 74 20 63 6f |. if|, not co|
|00002ad0| 6d 70 75 74 65 72 65 73 | 65 20 61 6e 64 20 6e 6f |mputeres|e and no|
|00002ae0| 74 20 74 6f 20 62 65 20 | 75 73 65 64 20 69 6e 20 |t to be |used in |
|00002af0| 42 41 53 49 43 29 20 74 | 68 65 20 63 6f 6e 64 69 |BASIC) t|he condi|
|00002b00| 74 69 6f 6e 20 67 69 76 | 65 6e 0d 0a 20 20 20 20 |tion giv|en.. |
|00002b10| 20 61 66 74 65 72 20 74 | 68 65 20 49 46 20 73 74 | after t|he IF st|
|00002b20| 61 74 65 6d 65 6e 74 20 | 69 73 20 74 72 75 65 2c |atement |is true,|
|00002b30| 20 74 68 65 6e 20 74 68 | 65 20 63 6f 6e 64 69 74 | then th|e condit|
|00002b40| 69 6f 6e 20 64 65 66 69 | 6e 65 64 20 62 79 20 74 |ion defi|ned by t|
|00002b50| 68 65 20 54 48 45 4e 0d | 0a 20 20 20 20 20 73 74 |he THEN.|. st|
|00002b60| 61 74 65 6d 65 6e 74 20 | 69 73 20 65 78 65 63 75 |atement |is execu|
|00002b70| 74 65 64 20 62 79 20 79 | 6f 75 72 20 70 72 6f 67 |ted by y|our prog|
|00002b80| 72 61 6d 2e 0d 0a 0d 0a | 20 20 20 20 20 54 68 65 |ram.....| The|
|00002b90| 20 61 62 6f 76 65 20 65 | 78 61 6d 70 6c 65 20 69 | above e|xample i|
|00002ba0| 73 20 74 68 65 20 73 69 | 6d 70 6c 65 73 74 20 61 |s the si|mplest a|
|00002bb0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6f 66 20 61 6e |pplicati|on of an|
|00002bc0| 20 49 46 2f 54 48 45 4e | 20 73 74 72 75 63 74 75 | IF/THEN| structu|
|00002bd0| 72 65 2e 0d 0a 20 20 20 | 20 20 49 74 20 68 61 73 |re... | It has|
|00002be0| 20 63 65 72 74 61 69 6e | 20 64 72 61 77 62 61 63 | certain| drawbac|
|00002bf0| 6b 73 2e 20 20 41 73 73 | 75 6d 65 20 74 68 61 74 |ks. Ass|ume that|
|00002c00| 20 79 6f 75 20 77 61 6e | 74 65 64 20 74 6f 20 70 | you wan|ted to p|
|00002c10| 72 69 6e 74 20 6f 75 74 | 20 22 41 4e 44 0d 0a 20 |rint out| "AND.. |
|00002c20| 20 20 20 20 54 48 41 54 | 27 53 20 52 45 41 4c 4c | THAT|'S REALL|
|00002c30| 59 20 54 41 4c 4c 22 20 | 6f 6e 20 61 20 73 65 70 |Y TALL" |on a sep|
|00002c40| 61 72 61 74 65 20 6c 69 | 6e 65 20 77 68 65 6e 20 |arate li|ne when |
|00002c50| 73 6f 6d 65 62 6f 64 79 | 20 69 73 20 6f 76 65 72 |somebody| is over|
|00002c60| 20 73 69 78 20 66 65 65 | 74 2e 0d 0a 20 20 20 20 | six fee|t... |
|00002c70| 20 54 68 65 20 6f 6e 6c | 79 20 77 61 79 20 6f 66 | The onl|y way of|
|00002c80| 20 61 63 63 6f 6d 70 6c | 69 73 68 69 6e 67 20 74 | accompl|ishing t|
|00002c90| 68 61 74 20 69 73 20 62 | 79 20 61 64 64 69 6e 67 |hat is b|y adding|
|00002ca0| 3a 0d 0a 0d 0a 20 20 20 | 20 20 31 33 35 20 49 46 |:.... | 135 IF|
|00002cb0| 20 48 45 49 47 48 54 20 | 3e 20 36 20 54 48 45 4e | HEIGHT |> 6 THEN|
|00002cc0| 20 50 52 49 4e 54 20 22 | 41 4e 44 20 54 48 41 54 | PRINT "|AND THAT|
|00002cd0| 27 53 20 52 45 41 4c 4c | 59 20 54 41 4c 4c 22 0d |'S REALL|Y TALL".|
|00002ce0| 0a 0d 0a 20 20 20 20 20 | 53 69 6d 69 6c 61 72 6c |... |Similarl|
|00002cf0| 79 2c 20 74 6f 20 61 64 | 64 20 22 54 48 41 54 27 |y, to ad|d "THAT'|
|00002d00| 53 20 52 45 41 4c 4c 59 | 20 53 4d 41 4c 4c 22 20 |S REALLY| SMALL" |
|00002d10| 66 6f 72 20 73 68 6f 72 | 74 20 70 65 6f 70 6c 65 |for shor|t people|
|00002d20| 20 6d 65 61 6e 73 20 61 | 64 64 69 6e 67 3a 0d 0a | means a|dding:..|
|00002d30| 0d 0a 20 20 20 20 20 31 | 34 35 20 49 46 20 48 45 |.. 1|45 IF HE|
|00002d40| 49 47 48 54 20 3c 20 35 | 20 54 48 45 4e 20 50 52 |IGHT < 5| THEN PR|
|00002d50| 49 4e 54 20 22 41 4e 44 | 20 54 48 41 54 27 53 20 |INT "AND| THAT'S |
|00002d60| 52 45 41 4c 4c 59 20 53 | 4d 41 4c 4c 22 0d 0a 0d |REALLY S|MALL"...|
|00002d70| 0a 20 20 20 20 20 4d 75 | 6c 74 69 70 6c 65 20 63 |. Mu|ltiple c|
|00002d80| 6f 6e 64 69 74 69 6f 6e | 61 6c 20 6f 75 74 70 75 |ondition|al outpu|
|00002d90| 74 20 66 6f 72 63 65 73 | 20 75 73 20 74 6f 20 6b |t forces| us to k|
|00002da0| 65 65 70 20 72 65 2d 74 | 65 73 74 69 6e 67 2e 20 |eep re-t|esting. |
|00002db0| 20 54 68 69 73 20 69 73 | 0d 0a 20 20 20 20 20 63 | This is|.. c|
|00002dc0| 6c 75 6d 73 79 20 61 6e | 64 20 76 65 72 79 20 74 |lumsy an|d very t|
|00002dd0| 69 6d 65 20 63 6f 6e 73 | 75 6d 69 6e 67 2e 20 20 |ime cons|uming. |
|00002de0| 54 68 65 20 6e 65 78 74 | 20 70 61 67 65 20 68 61 |The next| page ha|
|00002df0| 73 20 61 20 66 6c 6f 77 | 63 68 61 72 74 20 6f 66 |s a flow|chart of|
|00002e00| 20 74 68 69 73 0d 0a 20 | 20 20 20 20 70 72 6f 63 | this.. | proc|
|00002e10| 65 73 73 20 74 6f 20 73 | 68 6f 77 20 79 6f 75 20 |ess to s|how you |
|00002e20| 68 6f 77 20 74 6f 72 74 | 75 6f 75 73 20 69 74 20 |how tort|uous it |
|00002e30| 67 65 74 73 2e 0d 0a 0d | 0a 0d 0a 0d 0a 0d 0a 0d |gets....|........|
|00002e40| 0a 0d 0a 0d 0a 0d 0a 0d | 0a 0d 0a 0d 0a 0d 0a 20 |........|....... |
|00002e50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002e60| 1b 45 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.E | |
|00002e70| 20 20 1b 46 20 20 20 20 | 20 1b 45 20 20 32 37 0d | .F | .E 27.|
|00002e80| 0a 0d 0a 0c 0d 0a 0d 0a | 0d 0a 0d 0a 1b 46 20 20 |........|.....F |
|00002e90| 20 20 20 1b 45 43 48 41 | 50 54 45 52 20 33 1b 46 | .ECHA|PTER 3.F|
|00002ea0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00002eb0| 20 43 4c 45 41 4e 49 4e | 47 20 55 50 20 54 48 45 | CLEANIN|G UP THE|
|00002ec0| 20 41 43 54 1b 46 20 1b | 45 20 20 20 1b 46 20 20 | ACT.F .|E .F |
|00002ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00002ee0| 43 48 41 50 54 45 52 20 | 33 0d 0a 0d 0a 0d 0a 20 |CHAPTER |3...... |
|00002ef0| 20 20 20 20 49 46 2f 54 | 48 45 4e 20 46 4c 4f 57 | IF/T|HEN FLOW|
|00002f00| 43 48 41 52 54 0d 0a 0d | 0a 20 20 20 20 20 1b 46 |CHART...|. .F|
|00002f10| 48 65 72 65 20 69 73 20 | 74 68 65 0d 0a 20 20 20 |Here is |the.. |
|00002f20| 20 20 66 6c 6f 77 63 68 | 61 72 74 20 66 6f 72 0d | flowch|art for.|
|00002f30| 0a 20 20 20 20 20 74 68 | 65 20 70 72 6f 67 72 61 |. th|e progra|
|00002f40| 6d 0d 0a 20 20 20 20 20 | 6f 6e 20 74 68 65 20 70 |m.. |on the p|
|00002f50| 72 65 76 69 6f 75 73 0d | 0a 20 20 20 20 20 70 61 |revious.|. pa|
|00002f60| 67 65 2e 20 20 49 74 20 | 69 6e 63 6c 75 64 65 73 |ge. It |includes|
|00002f70| 0d 0a 20 20 20 20 20 74 | 68 65 20 74 77 6f 20 50 |.. t|he two P|
|00002f80| 52 49 4e 54 53 20 77 65 | 0d 0a 20 20 20 20 20 61 |RINTS we|.. a|
|00002f90| 64 64 65 64 2e 0d 0a 0d | 0a 20 20 20 20 20 53 65 |dded....|. Se|
|00002fa0| 65 20 68 6f 77 20 65 61 | 63 68 0d 0a 20 20 20 20 |e how ea|ch.. |
|00002fb0| 20 64 65 63 69 73 69 6f | 6e 20 69 73 20 6d 61 64 | decisio|n is mad|
|00002fc0| 65 0d 0a 20 20 20 20 20 | 61 6e 64 20 74 68 65 6e |e.. |and then|
|00002fd0| 20 66 6f 72 67 6f 74 74 | 65 6e 2e 0d 0a 20 20 20 | forgott|en... |
|00002fe0| 20 20 54 68 65 72 65 20 | 69 73 20 6e 6f 74 68 69 | There |is nothi|
|00002ff0| 6e 67 0d 0a 20 20 20 20 | 20 74 68 61 74 20 6b 65 |ng.. | that ke|
|00003000| 65 70 73 20 74 72 61 63 | 6b 0d 0a 20 20 20 20 20 |eps trac|k.. |
|00003010| 6f 66 20 77 68 65 74 68 | 65 72 20 77 65 0d 0a 20 |of wheth|er we.. |
|00003020| 20 20 20 20 68 61 76 65 | 20 74 65 73 74 65 64 20 | have| tested |
|00003030| 6f 6e 0d 0a 20 20 20 20 | 20 61 20 63 6f 6e 64 69 |on.. | a condi|
|00003040| 74 69 6f 6e 20 6f 6e 63 | 65 0d 0a 20 20 20 20 20 |tion onc|e.. |
|00003050| 61 6c 72 65 61 64 79 2e | 0d 0a 0d 0a 20 20 20 20 |already.|.... |
|00003060| 20 49 6e 20 61 20 77 61 | 79 2c 20 74 68 69 6e 6b | In a wa|y, think|
|00003070| 0d 0a 20 20 20 20 20 6f | 66 20 74 68 69 73 20 61 |.. o|f this a|
|00003080| 73 20 61 0d 0a 20 20 20 | 20 20 73 65 6e 69 6c 65 |s a.. | senile|
|00003090| 20 70 72 6f 67 72 61 6d | 0d 0a 20 20 20 20 20 63 | program|.. c|
|000030a0| 6f 6e 73 74 72 75 63 74 | 2c 20 69 74 0d 0a 20 20 |onstruct|, it.. |
|000030b0| 20 20 20 63 61 6e 27 74 | 20 72 65 6d 65 6d 62 65 | can't| remembe|
|000030c0| 72 0d 0a 20 20 20 20 20 | 61 6e 79 74 68 69 6e 67 |r.. |anything|
|000030d0| 20 61 6e 64 2c 20 79 65 | 73 2c 0d 0a 20 20 20 20 | and, ye|s,.. |
|000030e0| 20 69 74 20 67 65 74 73 | 20 6f 6c 64 20 76 65 72 | it gets| old ver|
|000030f0| 79 0d 0a 20 20 20 20 20 | 66 61 73 74 2e 0d 0a 0d |y.. |fast....|
|00003100| 0a 20 20 20 20 20 4f 6e | 20 74 6f 70 20 6f 66 20 |. On| top of |
|00003110| 65 76 65 72 79 0d 0a 20 | 20 20 20 20 74 68 69 6e |every.. | thin|
|00003120| 67 20 65 6c 73 65 2c 20 | 69 74 0d 0a 20 20 20 20 |g else, |it.. |
|00003130| 20 61 6c 73 6f 20 67 65 | 74 73 20 64 75 6c 6c 2e | also ge|ts dull.|
|00003140| 0d 0a 0d 0a 20 20 20 20 | 20 57 68 79 20 64 69 64 |.... | Why did|
|00003150| 20 77 65 20 73 68 6f 77 | 0d 0a 20 20 20 20 20 79 | we show|.. y|
|00003160| 6f 75 20 73 6f 6d 65 74 | 68 69 6e 67 20 61 73 20 |ou somet|hing as |
|00003170| 62 61 64 0d 0a 20 20 20 | 20 20 61 73 20 74 68 69 |bad.. | as thi|
|00003180| 73 3f 20 20 54 68 61 74 | 27 73 0d 0a 20 20 20 20 |s? That|'s.. |
|00003190| 20 72 69 67 68 74 2c 20 | 73 6f 20 77 65 20 63 6f | right, |so we co|
|000031a0| 75 6c 64 0d 0a 20 20 20 | 20 20 74 75 72 6e 20 61 |uld.. | turn a|
|000031b0| 72 6f 75 6e 64 20 61 6e | 64 0d 0a 20 20 20 20 20 |round an|d.. |
|000031c0| 73 68 6f 77 20 79 6f 75 | 20 73 6f 6d 65 74 68 69 |show you| somethi|
|000031d0| 6e 67 0d 0a 20 20 20 20 | 20 62 65 74 74 65 72 2e |ng.. | better.|
|000031e0| 0d 0a 0d 0a 20 20 20 20 | 20 48 6f 70 65 66 75 6c |.... | Hopeful|
|000031f0| 6c 79 2c 20 74 68 69 73 | 20 77 61 79 0d 0a 20 20 |ly, this| way.. |
|00003200| 20 20 20 79 6f 75 20 77 | 69 6c 6c 20 61 70 70 72 | you w|ill appr|
|00003210| 65 63 69 61 74 65 0d 0a | 20 20 20 20 20 74 68 65 |eciate..| the|
|00003220| 20 6e 65 77 65 72 20 73 | 74 75 66 66 20 61 0d 0a | newer s|tuff a..|
|00003230| 20 20 20 20 20 6c 69 74 | 74 6c 65 20 62 69 74 20 | lit|tle bit |
|00003240| 6d 6f 72 65 2e 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |more....|... |
|00003250| 54 68 65 20 74 72 69 63 | 6b 20 69 6e 20 64 6f 69 |The tric|k in doi|
|00003260| 6e 67 20 63 6f 6e 64 69 | 74 69 6f 6e 61 6c 20 6c |ng condi|tional l|
|00003270| 6f 67 69 63 20 69 73 20 | 74 6f 20 64 6f 20 69 74 |ogic is |to do it|
|00003280| 20 73 65 6c 65 63 74 69 | 76 65 6c 79 2c 20 65 2e | selecti|vely, e.|
|00003290| 67 2e 0d 0a 20 20 20 20 | 20 70 65 72 66 6f 72 6d |g... | perform|
|000032a0| 20 61 6c 6c 20 74 68 65 | 20 70 72 6f 63 65 73 73 | all the| process|
|000032b0| 69 6e 67 20 72 65 71 75 | 69 72 65 64 20 66 6f 72 |ing requ|ired for|
|000032c0| 20 61 20 67 69 76 65 6e | 20 63 6f 6e 64 69 74 69 | a given| conditi|
|000032d0| 6f 6e 20 62 61 73 65 64 | 20 6f 6e 20 6f 6e 6c 79 |on based| on only|
|000032e0| 0d 0a 20 20 20 20 20 6f | 6e 65 20 74 65 73 74 2e |.. o|ne test.|
|000032f0| 20 20 4f 6e 20 74 68 65 | 20 6e 65 78 74 20 70 61 | On the| next pa|
|00003300| 67 65 2c 20 79 6f 75 27 | 6c 6c 20 66 69 6e 64 20 |ge, you'|ll find |
|00003310| 61 20 6e 65 77 20 73 75 | 70 65 72 68 65 72 6f 20 |a new su|perhero |
|00003320| 6a 6f 69 6e 69 6e 67 20 | 74 68 65 0d 0a 20 20 20 |joining |the.. |
|00003330| 20 20 49 46 2f 54 48 45 | 4e 20 74 65 61 6d 20 74 | IF/THE|N team t|
|00003340| 6f 20 64 6f 20 62 61 74 | 74 6c 65 20 66 6f 72 20 |o do bat|tle for |
|00003350| 74 72 75 74 68 2c 20 6a | 75 73 74 69 63 65 20 61 |truth, j|ustice a|
|00003360| 6e 64 20 74 68 65 20 73 | 74 72 75 63 74 75 72 65 |nd the s|tructure|
|00003370| 64 20 77 61 79 2e 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |d way...|........|
|00003380| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003390| 20 1b 45 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|000033a0| 20 20 20 1b 46 20 20 20 | 20 20 1b 45 20 20 32 38 | .F | .E 28|
|000033b0| 0d 0a 0d 0a 0c 0d 0a 0d | 0a 0d 0a 0d 0a 1b 46 20 |........|......F |
|000033c0| 20 20 20 20 1b 45 43 48 | 41 50 54 45 52 20 33 1b | .ECH|APTER 3.|
|000033d0| 46 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b |F | .|
|000033e0| 45 20 43 4c 45 41 4e 49 | 4e 47 20 55 50 20 54 48 |E CLEANI|NG UP TH|
|000033f0| 45 20 41 43 54 1b 46 20 | 1b 45 20 20 20 1b 46 20 |E ACT.F |.E .F |
|00003400| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|00003410| 45 43 48 41 50 54 45 52 | 20 33 0d 0a 0d 0a 0d 0a |ECHAPTER| 3......|
|00003420| 20 20 20 20 20 1b 46 43 | 6f 6e 67 72 61 74 75 6c | .FC|ongratul|
|00003430| 61 74 69 6f 6e 73 2c 20 | 69 74 20 74 61 6b 65 73 |ations, |it takes|
|00003440| 20 67 75 74 73 20 74 6f | 20 74 75 72 6e 20 74 68 | guts to| turn th|
|00003450| 65 20 70 61 67 65 20 61 | 66 74 65 72 20 74 68 61 |e page a|fter tha|
|00003460| 74 20 6c 61 73 74 0d 0a | 20 20 20 20 20 70 61 72 |t last..| par|
|00003470| 61 67 72 61 70 68 2e 20 | 20 59 6f 75 20 6d 61 79 |agraph. | You may|
|00003480| 20 79 65 74 20 68 61 76 | 65 20 77 68 61 74 20 69 | yet hav|e what i|
|00003490| 74 20 74 61 6b 65 73 2e | 20 20 49 6e 20 61 6e 79 |t takes.| In any|
|000034a0| 20 63 61 73 65 2c 20 73 | 61 79 20 68 65 6c 6c 6f | case, s|ay hello|
|000034b0| 20 74 6f 0d 0a 20 20 20 | 20 20 74 68 65 20 45 4c | to.. | the EL|
|000034c0| 53 45 20 69 6e 73 74 72 | 75 63 74 69 6f 6e 2e 20 |SE instr|uction. |
|000034d0| 20 49 74 27 73 20 75 73 | 65 64 20 74 6f 67 65 74 | It's us|ed toget|
|000034e0| 68 65 72 20 77 69 74 68 | 20 74 68 65 20 49 46 2f |her with| the IF/|
|000034f0| 54 48 45 4e 2e 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |THEN....|... |
|00003500| 1b 45 49 46 2f 54 48 45 | 4e 2f 45 4c 53 45 0d 0a |.EIF/THE|N/ELSE..|
|00003510| 0d 0a 20 20 20 20 20 1b | 46 54 68 65 20 49 46 2f |.. .|FThe IF/|
|00003520| 54 48 45 4e 2f 45 4c 53 | 45 20 63 6f 6d 62 69 6e |THEN/ELS|E combin|
|00003530| 61 74 69 6f 6e 20 77 6f | 72 6b 73 20 61 73 20 66 |ation wo|rks as f|
|00003540| 6f 6c 6c 6f 77 73 2e 20 | 20 57 68 65 6e 20 74 68 |ollows. | When th|
|00003550| 65 20 63 6f 6d 70 75 74 | 65 72 20 66 69 6e 64 73 |e comput|er finds|
|00003560| 0d 0a 20 20 20 20 20 61 | 6e 20 49 46 2f 54 48 45 |.. a|n IF/THE|
|00003570| 4e 20 66 6f 6c 6c 6f 77 | 65 64 20 62 79 20 61 6e |N follow|ed by an|
|00003580| 20 45 4c 53 45 2c 20 69 | 74 20 70 65 72 66 6f 72 | ELSE, i|t perfor|
|00003590| 6d 73 20 61 6c 6c 20 74 | 68 65 20 63 6f 64 65 20 |ms all t|he code |
|000035a0| 61 66 74 65 72 20 74 68 | 65 0d 0a 20 20 20 20 20 |after th|e.. |
|000035b0| 49 46 2f 54 48 45 4e 20 | 69 66 20 74 68 65 20 63 |IF/THEN |if the c|
|000035c0| 6f 6d 70 61 72 69 73 6f | 6e 20 69 73 20 74 72 75 |ompariso|n is tru|
|000035d0| 65 2e 20 20 49 66 20 74 | 68 65 20 63 6f 6d 70 61 |e. If t|he compa|
|000035e0| 72 69 73 6f 6e 20 69 73 | 20 6e 6f 74 20 74 72 75 |rison is| not tru|
|000035f0| 65 2c 20 69 74 0d 0a 20 | 20 20 20 20 69 67 6e 6f |e, it.. | igno|
|00003600| 72 65 73 20 74 68 65 20 | 63 6f 64 65 20 61 66 74 |res the |code aft|
|00003610| 65 72 20 74 68 65 20 49 | 46 2f 54 48 45 4e 20 61 |er the I|F/THEN a|
|00003620| 6e 64 20 70 65 72 66 6f | 72 6d 73 20 61 6c 6c 20 |nd perfo|rms all |
|00003630| 74 68 65 20 63 6f 64 65 | 20 61 66 74 65 72 20 74 |the code| after t|
|00003640| 68 65 0d 0a 20 20 20 20 | 20 45 4c 53 45 2e 20 20 |he.. | ELSE. |
|00003650| 53 69 6e 63 65 20 61 20 | 73 61 6d 70 6c 65 20 70 |Since a |sample p|
|00003660| 72 6f 67 72 61 6d 20 69 | 73 20 77 6f 72 74 68 20 |rogram i|s worth |
|00003670| 61 20 74 68 6f 75 73 61 | 6e 64 20 77 6f 72 64 73 |a thousa|nd words|
|00003680| 20 28 66 6f 75 72 20 65 | 69 67 68 74 20 62 69 74 | (four e|ight bit|
|00003690| 0d 0a 20 20 20 20 20 62 | 79 74 65 73 20 74 6f 20 |.. b|ytes to |
|000036a0| 74 68 65 20 77 6f 72 64 | 20 66 6f 72 20 61 20 74 |the word| for a t|
|000036b0| 6f 74 61 6c 20 6f 66 20 | 33 32 4b 20 62 69 74 73 |otal of |32K bits|
|000036c0| 20 6f 72 20 24 38 2c 30 | 30 30 29 2c 20 6c 65 74 | or $8,0|00), let|
|000036d0| 27 73 20 77 72 69 74 65 | 20 6f 6e 65 2e 0d 0a 20 |'s write| one... |
|000036e0| 20 20 20 20 4f 75 72 20 | 66 72 69 65 6e 64 6c 79 | Our |friendly|
|000036f0| 20 73 79 73 74 65 6d 73 | 20 61 6e 61 6c 79 73 74 | systems| analyst|
|00003700| 20 28 74 68 65 79 27 72 | 65 20 72 65 61 6c 6c 79 | (they'r|e really|
|00003710| 20 77 6f 6e 64 65 72 66 | 75 6c 20 70 65 6f 70 6c | wonderf|ul peopl|
|00003720| 65 29 20 6f 6e 63 65 0d | 0a 20 20 20 20 20 61 67 |e) once.|. ag|
|00003730| 61 69 6e 20 63 6f 6d 65 | 73 20 74 6f 20 74 68 65 |ain come|s to the|
|00003740| 20 72 65 73 63 75 65 20 | 77 69 74 68 20 61 20 74 | rescue |with a t|
|00003750| 69 6d 65 6c 79 20 73 70 | 65 63 69 66 69 63 61 74 |imely sp|ecificat|
|00003760| 69 6f 6e 2e 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 1b |ion.....|.. .|
|00003770| 45 53 50 45 43 49 46 49 | 43 41 54 49 4f 4e 0d 0a |ESPECIFI|CATION..|
|00003780| 0d 0a 20 20 20 20 20 1b | 46 54 68 69 73 20 70 72 |.. .|FThis pr|
|00003790| 6f 67 72 61 6d 20 73 68 | 6f 75 6c 64 20 63 61 6c |ogram sh|ould cal|
|000037a0| 63 75 6c 61 74 65 20 61 | 6e 64 20 70 72 69 6e 74 |culate a|nd print|
|000037b0| 20 53 74 61 74 65 20 61 | 6e 64 20 46 65 64 65 72 | State a|nd Feder|
|000037c0| 61 6c 20 74 61 78 20 64 | 65 64 75 63 74 69 6f 6e |al tax d|eduction|
|000037d0| 73 0d 0a 20 20 20 20 20 | 66 6f 72 20 61 20 70 61 |s.. |for a pa|
|000037e0| 79 72 6f 6c 6c 2e 20 20 | 53 69 6e 63 65 20 74 68 |yroll. |Since th|
|000037f0| 65 20 74 61 78 20 63 6f | 64 65 20 68 61 73 20 6a |e tax co|de has j|
|00003800| 75 73 74 20 62 65 65 6e | 20 72 65 76 69 73 65 64 |ust been| revised|
|00003810| 2c 20 75 73 65 20 74 68 | 65 20 6e 65 77 0d 0a 20 |, use th|e new.. |
|00003820| 20 20 20 20 72 65 67 75 | 6c 61 74 69 6f 6e 73 20 | regu|lations |
|00003830| 77 68 65 72 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |where th|e follow|
|00003840| 69 6e 67 20 72 75 6c 65 | 73 20 61 70 70 6c 79 3a |ing rule|s apply:|
|00003850| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 2d 20 46 |.... | - F|
|00003860| 6f 72 20 61 20 77 65 65 | 6b 6c 79 20 73 61 6c 61 |or a wee|kly sala|
|00003870| 72 79 20 6c 65 73 73 20 | 74 68 61 6e 20 24 35 30 |ry less |than $50|
|00003880| 30 2c 20 74 68 65 20 74 | 61 78 65 73 20 61 72 65 |0, the t|axes are|
|00003890| 3a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |:.... | |
|000038a0| 46 65 64 65 72 61 6c 3a | 20 20 31 38 25 20 6f 66 |Federal:| 18% of|
|000038b0| 20 67 72 6f 73 73 20 73 | 61 6c 61 72 79 0d 0a 20 | gross s|alary.. |
|000038c0| 20 20 20 20 20 20 20 20 | 20 20 53 74 61 74 65 3a | | State:|
|000038d0| 20 20 20 20 31 31 25 20 | 6f 66 20 67 72 6f 73 73 | 11% |of gross|
|000038e0| 20 73 61 6c 61 72 79 0d | 0a 0d 0a 20 20 20 20 20 | salary.|... |
|000038f0| 20 20 20 20 2d 20 46 6f | 72 20 61 20 77 65 65 6b | - Fo|r a week|
|00003900| 6c 79 20 73 61 6c 61 72 | 79 20 6f 66 20 24 35 30 |ly salar|y of $50|
|00003910| 30 20 6f 72 20 6d 6f 72 | 65 2c 20 74 68 65 20 74 |0 or mor|e, the t|
|00003920| 61 78 65 73 20 61 72 65 | 3a 0d 0a 0d 0a 20 20 20 |axes are|:.... |
|00003930| 20 20 20 20 20 20 20 20 | 46 65 64 65 72 61 6c 3a | |Federal:|
|00003940| 20 20 32 33 25 20 6f 66 | 20 67 72 6f 73 73 20 73 | 23% of| gross s|
|00003950| 61 6c 61 72 79 0d 0a 20 | 20 20 20 20 20 20 20 20 |alary.. | |
|00003960| 20 20 53 74 61 74 65 3a | 20 20 20 20 31 34 25 20 | State:| 14% |
|00003970| 6f 66 20 67 72 6f 73 73 | 20 73 61 6c 61 72 79 0d |of gross| salary.|
|00003980| 0a 0d 0a 20 20 20 20 20 | 44 69 73 70 6c 61 79 20 |... |Display |
|00003990| 6c 61 73 74 20 6e 61 6d | 65 2c 20 73 6f 63 69 61 |last nam|e, socia|
|000039a0| 6c 20 73 65 63 75 72 69 | 74 79 20 6e 75 6d 62 65 |l securi|ty numbe|
|000039b0| 72 2c 20 67 72 6f 73 73 | 20 70 61 79 2c 20 46 65 |r, gross| pay, Fe|
|000039c0| 64 65 72 61 6c 20 74 61 | 78 2c 20 53 74 61 74 65 |deral ta|x, State|
|000039d0| 0d 0a 20 20 20 20 20 74 | 61 78 20 61 6e 64 20 6e |.. t|ax and n|
|000039e0| 65 74 20 70 61 79 20 28 | 77 68 65 72 65 20 6e 65 |et pay (|where ne|
|000039f0| 74 20 70 61 79 20 69 73 | 20 67 72 6f 73 73 20 70 |t pay is| gross p|
|00003a00| 61 79 20 2d 20 61 6c 6c | 20 74 61 78 65 73 29 2e |ay - all| taxes).|
|00003a10| 20 20 4d 61 6b 65 20 73 | 75 72 65 20 79 6f 75 0d | Make s|ure you.|
|00003a20| 0a 20 20 20 20 20 63 6f | 75 6e 74 20 74 68 65 20 |. co|unt the |
|00003a30| 74 6f 74 61 6c 20 63 68 | 65 63 6b 73 20 77 72 69 |total ch|ecks wri|
|00003a40| 74 74 65 6e 20 61 6e 64 | 20 61 63 63 75 6d 75 6c |tten and| accumul|
|00003a50| 61 74 65 20 61 6e 64 20 | 70 72 69 6e 74 20 74 68 |ate and |print th|
|00003a60| 65 20 67 72 6f 73 73 0d | 0a 20 20 20 20 20 70 61 |e gross.|. pa|
|00003a70| 79 72 6f 6c 6c 2c 20 46 | 65 64 65 72 61 6c 20 74 |yroll, F|ederal t|
|00003a80| 61 78 65 73 2c 20 61 6e | 64 20 53 74 61 74 65 20 |axes, an|d State |
|00003a90| 74 61 78 65 73 20 61 74 | 20 74 68 65 20 65 6e 64 |taxes at| the end|
|00003aa0| 20 6f 66 20 74 68 65 20 | 70 72 6f 67 72 61 6d 2e | of the |program.|
|00003ab0| 0d 0a 0d 0a 20 20 20 20 | 20 4f 75 74 70 75 74 20 |.... | Output |
|00003ac0| 46 6f 72 6d 61 74 3a 0d | 0a 0d 0a 20 20 20 20 20 |Format:.|... |
|00003ad0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003ae0| 20 20 20 20 20 20 20 20 | 20 20 20 57 45 45 4b 4c | | WEEKL|
|00003af0| 59 20 50 41 59 52 4f 4c | 4c 20 52 45 50 4f 52 54 |Y PAYROL|L REPORT|
|00003b00| 0d 0a 0d 0a 20 20 20 20 | 20 4c 41 53 54 20 4e 41 |.... | LAST NA|
|00003b10| 4d 45 20 20 20 20 20 20 | 20 53 53 4e 20 20 20 20 |ME | SSN |
|00003b20| 20 20 20 20 20 20 47 52 | 4f 53 53 20 20 20 20 20 | GR|OSS |
|00003b30| 20 20 46 45 44 45 52 41 | 4c 20 20 20 20 20 20 53 | FEDERA|L S|
|00003b40| 54 41 54 45 20 20 20 1b | 45 20 20 20 1b 46 20 20 |TATE .|E .F |
|00003b50| 4e 45 54 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |NET.. | |
|00003b60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003b70| 20 20 20 20 20 20 53 41 | 4c 41 52 59 20 20 20 20 | SA|LARY |
|00003b80| 20 20 20 20 20 54 41 58 | 20 20 20 20 20 20 20 20 | TAX| |
|00003b90| 20 54 41 58 1b 45 20 20 | 20 20 20 20 20 1b 46 20 | TAX.E | .F |
|00003ba0| 53 41 4c 41 52 59 0d 0a | 20 20 20 20 20 2d 2d 2d |SALARY..| ---|
|00003bb0| 2d 2d 2d 2d 2d 2d 20 20 | 20 20 2d 2d 2d 2d 2d 2d |------ | ------|
|00003bc0| 2d 2d 2d 2d 20 20 20 20 | 20 2d 2d 2d 2d 2d 2d 20 |---- | ------ |
|00003bd0| 20 20 20 20 20 20 2d 2d | 2d 2d 2d 2d 2d 20 20 20 | --|----- |
|00003be0| 20 20 20 2d 2d 2d 2d 2d | 1b 45 20 20 20 20 20 20 | -----|.E |
|00003bf0| 20 1b 46 2d 2d 2d 2d 2d | 2d 0d 0a 0d 0a 20 20 20 | .F-----|-.... |
|00003c00| 20 20 2e 2e 2e 2e 2e 2e | 2e 2e 2e 20 20 20 20 20 | ......|... |
|00003c10| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 20 20 20 20 20 2e 2e |........|. ..|
|00003c20| 2e 2e 2e 2e 2e 20 20 20 | 20 20 20 2e 2e 2e 2e 2e |..... | .....|
|00003c30| 2e 2e 2e 20 20 20 20 20 | 2e 2e 2e 2e 2e 20 20 20 |... |..... |
|00003c40| 20 20 20 20 2e 2e 2e 2e | 2e 2e 0d 0a 20 20 20 20 | ....|.... |
|00003c50| 20 2e 2e 2e 2e 2e 2e 2e | 2e 2e 20 20 20 20 20 2e | .......|.. .|
|00003c60| 2e 2e 2e 2e 2e 2e 2e 2e | 20 20 20 20 20 2e 2e 2e |........| ...|
|00003c70| 2e 2e 2e 2e 20 20 20 20 | 20 20 2e 2e 2e 2e 2e 2e |.... | ......|
|00003c80| 2e 2e 20 20 20 20 20 2e | 2e 2e 2e 2e 20 20 20 20 |.. .|.... |
|00003c90| 20 20 20 2e 2e 2e 2e 2e | 2e 0d 0a 0d 0a 20 20 20 | .....|..... |
|00003ca0| 20 20 54 6f 74 61 6c 20 | 6f 6e 20 50 61 79 72 6f | Total |on Payro|
|00003cb0| 6c 6c 3a 20 20 20 2e 2e | 2e 2e 2e 2e 2e 0d 0a 20 |ll: ..|....... |
|00003cc0| 20 20 20 20 54 6f 74 61 | 6c 20 6f 66 20 50 61 79 | Tota|l of Pay|
|00003cd0| 72 6f 6c 6c 3a 20 20 20 | 2e 2e 2e 2e 2e 2e 2e 0d |roll: |........|
|00003ce0| 0a 20 20 20 20 20 54 6f | 74 61 6c 20 46 65 64 65 |. To|tal Fede|
|00003cf0| 72 61 6c 20 54 61 78 3a | 20 20 2e 2e 2e 2e 2e 2e |ral Tax:| ......|
|00003d00| 2e 0d 0a 20 20 20 20 20 | 54 6f 74 61 6c 20 53 74 |... |Total St|
|00003d10| 61 74 65 20 54 61 78 3a | 20 20 20 20 2e 2e 2e 2e |ate Tax:| ....|
|00003d20| 2e 2e 2e 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 20 20 |........|. |
|00003d30| 20 20 20 20 20 20 20 20 | 20 20 1b 45 20 20 20 20 | | .E |
|00003d40| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 46 20 20 | | .F |
|00003d50| 20 20 20 1b 45 20 20 32 | 39 0d 0a 0d 0a 0c 0d 0a | .E 2|9.......|
|00003d60| 0d 0a 0d 0a 0d 0a 1b 46 | 20 20 20 20 20 1b 45 43 |.......F| .EC|
|00003d70| 48 41 50 54 45 52 20 33 | 1b 46 20 20 20 20 20 20 |HAPTER 3|.F |
|00003d80| 20 20 20 20 20 20 20 20 | 1b 45 20 43 4c 45 41 4e | |.E CLEAN|
|00003d90| 49 4e 47 20 55 50 20 54 | 48 45 20 41 43 54 1b 46 |ING UP T|HE ACT.F|
|00003da0| 20 1b 45 20 20 20 1b 46 | 20 20 20 20 20 20 20 20 | .E .F| |
|00003db0| 20 20 20 20 20 20 20 20 | 1b 45 43 48 41 50 54 45 | |.ECHAPTE|
|00003dc0| 52 20 33 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 1b 46 |R 3.....|. .F|
|00003dd0| 53 61 6d 70 6c 65 20 44 | 61 74 61 3a 0d 0a 0d 0a |Sample D|ata:....|
|00003de0| 20 20 20 20 20 4e 61 6d | 65 20 20 20 20 20 20 20 | Nam|e |
|00003df0| 20 20 20 20 20 53 53 4e | 20 20 20 20 20 20 20 20 | SSN| |
|00003e00| 20 20 20 20 57 65 65 6b | 6c 79 20 47 72 6f 73 73 | Week|ly Gross|
|00003e10| 0d 0a 20 20 20 20 20 2d | 2d 2d 2d 2d 2d 2d 20 20 |.. -|------ |
|00003e20| 20 20 20 20 20 20 20 2d | 2d 2d 20 20 20 20 20 20 | -|-- |
|00003e30| 20 20 20 20 20 20 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | --|--------|
|00003e40| 2d 2d 0d 0a 0d 0a 20 20 | 20 20 20 53 6d 69 6c 65 |--.... | Smile|
|00003e50| 79 20 20 20 20 20 20 31 | 31 31 2d 31 31 2d 31 31 |y 1|11-11-11|
|00003e60| 31 31 20 20 20 20 20 20 | 20 20 20 32 33 34 2e 30 |11 | 234.0|
|00003e70| 30 0d 0a 20 20 20 20 20 | 44 6f 70 65 79 20 20 20 |0.. |Dopey |
|00003e80| 20 20 20 20 32 32 32 2d | 32 32 2d 32 32 32 32 20 | 222-|22-2222 |
|00003e90| 20 20 20 20 20 20 20 20 | 34 39 39 2e 30 30 0d 0a | |499.00..|
|00003ea0| 20 20 20 20 20 47 72 75 | 6d 70 79 20 20 20 20 20 | Gru|mpy |
|00003eb0| 20 33 33 33 2d 33 33 2d | 33 33 33 33 20 20 20 20 | 333-33-|3333 |
|00003ec0| 20 20 20 20 20 35 30 30 | 2e 30 30 0d 0a 20 20 20 | 500|.00.. |
|00003ed0| 20 20 44 6f 63 20 20 20 | 20 20 20 20 20 20 34 34 | Doc | 44|
|00003ee0| 34 2d 34 34 2d 34 34 34 | 34 20 20 20 20 20 20 20 |4-44-444|4 |
|00003ef0| 20 31 32 30 30 2e 30 30 | 0d 0a 20 20 20 20 20 53 | 1200.00|.. S|
|00003f00| 6e 6f 77 68 69 74 65 20 | 20 20 20 39 39 39 2d 39 |nowhite | 999-9|
|00003f10| 39 2d 39 39 39 39 20 20 | 20 20 20 20 20 20 35 34 |9-9999 | 54|
|00003f20| 30 30 2e 30 31 0d 0a 0d | 0a 20 20 20 20 20 54 68 |00.01...|. Th|
|00003f30| 65 20 61 62 6f 76 65 20 | 70 72 6f 67 72 61 6d 20 |e above |program |
|00003f40| 69 73 20 6e 65 65 64 65 | 64 20 62 79 20 74 68 65 |is neede|d by the|
|00003f50| 20 64 61 79 20 62 65 66 | 6f 72 65 20 79 65 73 74 | day bef|ore yest|
|00003f60| 65 72 64 61 79 20 61 74 | 20 74 68 65 20 6c 61 74 |erday at| the lat|
|00003f70| 65 73 74 2e 0d 0a 20 20 | 20 20 20 54 68 61 6e 6b |est... | Thank|
|00003f80| 20 79 6f 75 2e 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 | you....|... |
|00003f90| 42 65 66 6f 72 65 20 63 | 6f 64 69 6e 67 2c 20 77 |Before c|oding, w|
|00003fa0| 65 20 6e 65 65 64 20 74 | 6f 20 63 72 65 61 74 65 |e need t|o create|
|00003fb0| 20 61 20 66 6c 6f 77 63 | 68 61 72 74 2e 20 20 49 | a flowc|hart. I|
|00003fc0| 74 20 73 74 61 72 74 73 | 20 62 65 6c 6f 77 2e 20 |t starts| below. |
|00003fd0| 20 53 69 6e 63 65 0d 0a | 20 20 20 20 20 74 68 65 | Since..| the|
|00003fe0| 72 65 20 69 73 20 6e 6f | 74 20 65 6e 6f 75 67 68 |re is no|t enough|
|00003ff0| 20 73 70 61 63 65 20 6f | 6e 20 74 68 65 20 70 61 | space o|n the pa|
|00004000| 67 65 2c 20 77 65 20 75 | 73 65 20 61 6e 20 6f 66 |ge, we u|se an of|
|00004010| 66 20 70 61 67 65 20 63 | 6f 6e 6e 65 63 74 6f 72 |f page c|onnector|
|00004020| 0d 0a 20 20 20 20 20 61 | 66 74 65 72 20 74 68 65 |.. a|fter the|
|00004030| 20 70 72 69 6e 74 20 68 | 65 61 64 69 6e 67 73 20 | print h|eadings |
|00004040| 73 74 61 74 65 6d 65 6e | 74 20 61 6e 64 20 70 69 |statemen|t and pi|
|00004050| 63 6b 20 69 74 20 75 70 | 20 6f 6e 20 74 68 65 20 |ck it up| on the |
|00004060| 6e 65 78 74 20 70 61 67 | 65 2e 20 20 42 79 0d 0a |next pag|e. By..|
|00004070| 20 20 20 20 20 62 72 65 | 61 6b 69 6e 67 20 74 68 | bre|aking th|
|00004080| 65 20 66 6c 6f 77 63 68 | 61 72 74 20 75 70 20 61 |e flowch|art up a|
|00004090| 74 20 74 68 69 73 20 70 | 6f 69 6e 74 2c 20 77 65 |t this p|oint, we|
|000040a0| 20 68 61 76 65 20 74 68 | 65 20 63 6f 6d 70 6c 65 | have th|e comple|
|000040b0| 74 65 20 6c 6f 6f 70 20 | 6f 6e 0d 0a 20 20 20 20 |te loop |on.. |
|000040c0| 20 74 68 65 20 6e 65 78 | 74 20 70 61 67 65 20 61 | the nex|t page a|
|000040d0| 6e 64 20 74 68 75 73 20 | 64 6f 6e 27 74 20 6e 65 |nd thus |don't ne|
|000040e0| 65 64 20 74 6f 20 63 6f | 6e 6e 65 63 74 20 62 61 |ed to co|nnect ba|
|000040f0| 63 6b 2e 20 20 54 68 69 | 73 20 69 73 20 6e 6f 74 |ck. Thi|s is not|
|00004100| 20 61 6c 77 61 79 73 0d | 0a 20 20 20 20 20 70 6f | always.|. po|
|00004110| 73 73 69 62 6c 65 2c 20 | 68 6f 77 65 76 65 72 20 |ssible, |however |
|00004120| 77 68 65 6e 20 79 6f 75 | 20 68 61 76 65 20 74 68 |when you| have th|
|00004130| 65 20 6f 70 74 69 6f 6e | 2c 20 74 72 79 20 74 6f |e option|, try to|
|00004140| 20 6f 72 67 61 6e 69 7a | 65 20 79 6f 75 72 0d 0a | organiz|e your..|
|00004150| 20 20 20 20 20 66 6c 6f | 77 63 68 61 72 74 20 61 | flo|wchart a|
|00004160| 73 20 77 65 6c 6c 20 61 | 73 20 79 6f 75 20 77 6f |s well a|s you wo|
|00004170| 75 6c 64 20 6f 72 67 61 | 6e 69 7a 65 20 79 6f 75 |uld orga|nize you|
|00004180| 72 20 70 72 6f 67 72 61 | 6d 2e 0d 0a 0d 0a 0d 0a |r progra|m.......|
|00004190| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000041a0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000041b0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000041c0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 20 20 |........|...... |
|000041d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|000041e0| 45 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |E | |
|000041f0| 20 1b 46 20 20 20 20 20 | 1b 45 20 20 33 30 0d 0a | .F |.E 30..|
|00004200| 0d 0a 0c 0d 0a 0d 0a 0d | 0a 0d 0a 1b 46 20 20 20 |........|....F |
|00004210| 20 20 1b 45 43 48 41 50 | 54 45 52 20 33 1b 46 20 | .ECHAP|TER 3.F |
|00004220| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 20 | | .E |
|00004230| 43 4c 45 41 4e 49 4e 47 | 20 55 50 20 54 48 45 20 |CLEANING| UP THE |
|00004240| 41 43 54 1b 46 20 1b 45 | 20 20 20 1b 46 20 20 20 |ACT.F .E| .F |
|00004250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 43 | | .EC|
|00004260| 48 41 50 54 45 52 20 33 | 0d 0a 0d 0a 0d 0a 0d 0a |HAPTER 3|........|
|00004270| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004280| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004290| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000042a0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000042b0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000042c0| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|000042d0| 0d 0a 0d 0a 20 20 20 20 | 20 1b 46 4e 65 78 74 20 |.... | .FNext |
|000042e0| 77 65 27 6c 6c 20 73 74 | 61 72 74 20 63 6f 64 69 |we'll st|art codi|
|000042f0| 6e 67 2c 20 61 6e 64 20 | 65 78 70 6c 61 69 6e 20 |ng, and |explain |
|00004300| 74 68 65 20 49 46 2f 54 | 48 45 4e 2f 45 4c 53 45 |the IF/T|HEN/ELSE|
|00004310| 20 61 73 20 77 65 20 69 | 6e 63 6f 72 70 6f 72 61 | as we i|ncorpora|
|00004320| 74 65 0d 0a 20 20 20 20 | 20 69 74 20 69 6e 74 6f |te.. | it into|
|00004330| 20 6f 75 72 20 6c 6f 67 | 69 63 2e 0d 0a 0d 0a 0d | our log|ic......|
|00004340| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00004350| 20 20 1b 45 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00004360| 20 20 20 20 1b 46 20 20 | 20 20 20 1b 45 20 20 33 | .F | .E 3|
|00004370| 31 0d 0a 0d 0a 0c 0d 0a | 0d 0a 0d 0a 0d 0a 1b 46 |1.......|.......F|
|00004380| 20 20 20 20 20 1b 45 43 | 48 41 50 54 45 52 20 33 | .EC|HAPTER 3|
|00004390| 1b 46 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.F | |
|000043a0| 1b 45 20 43 4c 45 41 4e | 49 4e 47 20 55 50 20 54 |.E CLEAN|ING UP T|
|000043b0| 48 45 20 41 43 54 1b 46 | 20 1b 45 20 20 20 1b 46 |HE ACT.F| .E .F|
|000043c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000043d0| 1b 45 43 48 41 50 54 45 | 52 20 33 0d 0a 0d 0a 0d |.ECHAPTE|R 3.....|
|000043e0| 0a 20 20 20 20 20 1b 46 | 31 30 30 20 27 20 20 50 |. .F|100 ' P|
|000043f0| 52 4f 47 52 41 4d 20 4e | 41 4d 45 3a 20 50 41 59 |ROGRAM N|AME: PAY|
|00004400| 52 4f 4c 4c 0d 0a 20 20 | 20 20 20 31 31 30 20 27 |ROLL.. | 110 '|
|00004410| 20 20 57 52 49 54 54 45 | 4e 20 42 59 3a 20 20 20 | WRITTE|N BY: |
|00004420| 54 2e 20 41 55 54 48 4f | 52 0d 0a 20 20 20 20 20 |T. AUTHO|R.. |
|00004430| 31 32 30 20 27 20 20 44 | 41 54 45 20 57 52 49 54 |120 ' D|ATE WRIT|
|00004440| 54 45 4e 3a 20 31 32 2f | 30 32 2f 38 34 0d 0a 20 |TEN: 12/|02/84.. |
|00004450| 20 20 20 20 31 33 30 20 | 27 0d 0a 20 20 20 20 20 | 130 |'.. |
|00004460| 31 34 30 20 27 20 20 54 | 48 49 53 20 50 52 4f 47 |140 ' T|HIS PROG|
|00004470| 52 41 4d 20 43 41 4c 43 | 55 4c 41 54 45 53 20 50 |RAM CALC|ULATES P|
|00004480| 41 59 52 4f 4c 4c 20 44 | 45 44 55 43 54 49 4f 4e |AYROLL D|EDUCTION|
|00004490| 53 20 46 4f 52 20 46 45 | 44 45 52 41 4c 20 41 4e |S FOR FE|DERAL AN|
|000044a0| 44 20 53 54 41 54 45 0d | 0a 20 20 20 20 20 31 35 |D STATE.|. 15|
|000044b0| 30 20 27 20 20 54 41 58 | 45 53 20 42 41 53 45 44 |0 ' TAX|ES BASED|
|000044c0| 20 4f 4e 20 54 48 45 20 | 4e 45 57 20 49 2d 43 41 | ON THE |NEW I-CA|
|000044d0| 4e 2d 54 2d 42 45 4c 49 | 45 56 45 20 43 4f 44 45 |N-T-BELI|EVE CODE|
|000044e0| 2e 20 20 49 54 20 43 4f | 55 4e 54 53 20 54 48 45 |. IT CO|UNTS THE|
|000044f0| 20 54 4f 54 41 4c 0d 0a | 20 20 20 20 20 31 36 30 | TOTAL..| 160|
|00004500| 20 27 20 20 50 45 4f 50 | 4c 45 20 4f 4e 20 54 48 | ' PEOP|LE ON TH|
|00004510| 45 20 50 41 59 52 4f 4c | 4c 20 41 4e 44 20 41 43 |E PAYROL|L AND AC|
|00004520| 43 55 4d 55 4c 41 54 45 | 53 20 47 52 4f 53 53 20 |CUMULATE|S GROSS |
|00004530| 53 41 4c 41 52 59 20 41 | 53 20 57 45 4c 4c 20 41 |SALARY A|S WELL A|
|00004540| 53 0d 0a 20 20 20 20 20 | 31 37 30 20 27 20 20 53 |S.. |170 ' S|
|00004550| 54 41 54 45 20 41 4e 44 | 20 46 45 44 45 52 41 4c |TATE AND| FEDERAL|
|00004560| 20 54 41 58 45 53 0d 0a | 20 20 20 20 20 31 38 30 | TAXES..| 180|
|00004570| 20 27 0d 0a 20 20 20 20 | 20 31 39 30 20 27 20 20 | '.. | 190 ' |
|00004580| 49 4e 50 55 54 20 56 41 | 52 49 41 42 4c 45 20 4e |INPUT VA|RIABLE N|
|00004590| 41 4d 45 53 0d 0a 20 20 | 20 20 20 32 30 30 20 27 |AMES.. | 200 '|
|000045a0| 0d 0a 20 20 20 20 20 32 | 31 30 20 27 20 20 4c 41 |.. 2|10 ' LA|
|000045b0| 53 54 2e 4e 41 4d 45 24 | 20 2e 2e 2e 2e 2e 2e 2e |ST.NAME$| .......|
|000045c0| 2e 2e 2e 2e 2e 2e 20 4c | 41 53 54 20 4e 41 4d 45 |...... L|AST NAME|
|000045d0| 20 4f 46 20 50 41 59 45 | 45 2c 20 49 4e 50 55 54 | OF PAYE|E, INPUT|
|000045e0| 0d 0a 20 20 20 20 20 32 | 32 30 20 27 20 20 53 53 |.. 2|20 ' SS|
|000045f0| 4e 24 20 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |N$ .....|........|
|00004600| 2e 2e 2e 2e 2e 2e 20 53 | 4f 43 49 41 4c 20 53 45 |...... S|OCIAL SE|
|00004610| 43 55 52 49 54 59 20 4e | 55 4d 42 45 52 20 4f 46 |CURITY N|UMBER OF|
|00004620| 20 50 41 59 45 45 2c 20 | 49 4e 50 55 54 0d 0a 20 | PAYEE, |INPUT.. |
|00004630| 20 20 20 20 32 33 30 20 | 27 20 20 47 52 4f 53 53 | 230 |' GROSS|
|00004640| 2e 50 41 59 20 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |.PAY ...|........|
|00004650| 2e 2e 2e 20 47 52 4f 53 | 53 20 50 41 59 20 4f 46 |... GROS|S PAY OF|
|00004660| 20 50 41 59 45 45 2c 20 | 49 4e 50 55 54 0d 0a 20 | PAYEE, |INPUT.. |
|00004670| 20 20 20 20 32 34 30 20 | 27 0d 0a 20 20 20 20 20 | 240 |'.. |
|00004680| 32 35 30 20 27 20 20 4f | 54 48 45 52 20 56 41 52 |250 ' O|THER VAR|
|00004690| 49 41 42 4c 45 53 20 41 | 4e 44 20 43 4f 4e 53 54 |IABLES A|ND CONST|
|000046a0| 41 4e 54 53 0d 0a 20 20 | 20 20 20 32 36 30 20 27 |ANTS.. | 260 '|
|000046b0| 0d 0a 20 20 20 20 20 32 | 37 30 20 27 20 20 46 45 |.. 2|70 ' FE|
|000046c0| 44 2e 54 41 58 20 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |D.TAX ..|........|
|000046d0| 2e 2e 2e 2e 2e 2e 20 4f | 55 54 50 55 54 2c 20 43 |...... O|UTPUT, C|
|000046e0| 41 4c 43 55 4c 41 54 45 | 44 20 46 45 44 45 52 41 |ALCULATE|D FEDERA|
|000046f0| 4c 20 54 41 58 0d 0a 20 | 20 20 20 20 32 38 30 20 |L TAX.. | 280 |
|00004700| 27 20 20 53 54 41 54 45 | 2e 54 41 58 20 2e 2e 2e |' STATE|.TAX ...|
|00004710| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 20 4f 55 54 50 |........|... OUTP|
|00004720| 55 54 2c 20 43 41 4c 43 | 55 4c 41 54 45 44 20 53 |UT, CALC|ULATED S|
|00004730| 54 41 54 45 20 54 41 58 | 0d 0a 20 20 20 20 20 32 |TATE TAX|.. 2|
|00004740| 39 30 20 27 20 20 4e 45 | 54 2e 50 41 59 20 2e 2e |90 ' NE|T.PAY ..|
|00004750| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 20 4f |........|...... O|
|00004760| 55 54 50 55 54 2c 20 47 | 52 4f 53 53 20 50 41 59 |UTPUT, G|ROSS PAY|
|00004770| 20 2d 20 54 41 58 45 53 | 0d 0a 20 20 20 20 20 33 | - TAXES|.. 3|
|00004780| 30 30 20 27 20 20 46 45 | 44 2e 4c 4f 20 2e 2e 2e |00 ' FE|D.LO ...|
|00004790| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 20 43 |........|...... C|
|000047a0| 4f 4e 53 54 41 4e 54 2c | 20 46 45 44 45 52 41 4c |ONSTANT,| FEDERAL|
|000047b0| 20 52 41 54 45 20 4f 4e | 20 3c 20 4c 4f 2e 54 45 | RATE ON| < LO.TE|
|000047c0| 53 54 0d 0a 20 20 20 20 | 20 33 31 30 20 27 20 20 |ST.. | 310 ' |
|000047d0| 46 45 44 2e 48 49 20 2e | 2e 2e 2e 2e 2e 2e 2e 2e |FED.HI .|........|
|000047e0| 2e 2e 2e 2e 2e 2e 2e 2e | 20 43 4f 4e 53 54 41 4e |........| CONSTAN|
|000047f0| 54 2c 20 46 45 44 45 52 | 41 4c 20 52 41 54 45 20 |T, FEDER|AL RATE |
|00004800| 4f 4e 20 3e 3d 20 4c 4f | 2e 54 45 53 54 0d 0a 20 |ON >= LO|.TEST.. |
|00004810| 20 20 20 20 33 32 30 20 | 27 20 20 53 54 41 54 45 | 320 |' STATE|
|00004820| 2e 4c 4f 20 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |.LO ....|........|
|00004830| 2e 2e 2e 20 43 4f 4e 53 | 54 41 4e 54 2c 20 53 54 |... CONS|TANT, ST|
|00004840| 41 54 45 20 52 41 54 45 | 20 4f 4e 20 3c 20 4c 4f |ATE RATE| ON < LO|
|00004850| 2e 54 45 53 54 0d 0a 20 | 20 20 20 20 33 33 30 20 |.TEST.. | 330 |
|00004860| 27 20 20 53 54 41 54 45 | 2e 48 49 20 2e 2e 2e 2e |' STATE|.HI ....|
|00004870| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 20 43 4f 4e 53 |........|... CONS|
|00004880| 54 41 4e 54 2c 20 53 54 | 41 54 45 20 52 41 54 45 |TANT, ST|ATE RATE|
|00004890| 20 4f 4e 20 3e 3d 20 4c | 4f 2e 54 45 53 54 0d 0a | ON >= L|O.TEST..|
|000048a0| 20 20 20 20 20 33 34 30 | 20 27 20 20 4c 4f 2e 54 | 340| ' LO.T|
|000048b0| 45 53 54 20 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |EST ....|........|
|000048c0| 2e 2e 2e 2e 20 43 4f 4e | 53 54 41 4e 54 2c 20 43 |.... CON|STANT, C|
|000048d0| 55 54 4f 46 46 20 46 4f | 52 20 46 45 44 45 52 41 |UTOFF FO|R FEDERA|
|000048e0| 4c 20 52 41 54 45 20 54 | 45 53 54 53 0d 0a 20 20 |L RATE T|ESTS.. |
|000048f0| 20 20 20 33 35 30 20 27 | 20 20 54 4f 54 2e 50 45 | 350 '| TOT.PE|
|00004900| 4f 50 20 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |OP .....|........|
|00004910| 2e 2e 20 43 4f 55 4e 54 | 45 52 2c 20 4e 55 4d 42 |.. COUNT|ER, NUMB|
|00004920| 45 52 20 4f 46 20 50 45 | 4f 50 4c 45 20 4f 4e 20 |ER OF PE|OPLE ON |
|00004930| 50 41 59 52 4f 4c 4c 0d | 0a 20 20 20 20 20 33 36 |PAYROLL.|. 36|
|00004940| 30 20 27 20 20 54 4f 54 | 2e 50 41 59 20 2e 2e 2e |0 ' TOT|.PAY ...|
|00004950| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 20 41 43 |........|..... AC|
|00004960| 43 55 4d 55 4c 41 54 4f | 52 2c 20 54 4f 54 41 4c |CUMULATO|R, TOTAL|
|00004970| 20 50 41 59 52 4f 4c 4c | 20 44 4f 4c 4c 41 52 53 | PAYROLL| DOLLARS|
|00004980| 0d 0a 20 20 20 20 20 33 | 37 30 20 27 20 20 54 4f |.. 3|70 ' TO|
|00004990| 54 2e 46 45 44 20 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |T.FED ..|........|
|000049a0| 2e 2e 2e 2e 2e 2e 20 41 | 43 43 55 4d 55 4c 41 54 |...... A|CCUMULAT|
|000049b0| 4f 52 2c 20 54 4f 54 41 | 4c 20 46 45 44 45 52 41 |OR, TOTA|L FEDERA|
|000049c0| 4c 20 54 41 58 0d 0a 20 | 20 20 20 20 33 38 30 20 |L TAX.. | 380 |
|000049d0| 27 20 20 54 4f 54 2e 53 | 54 41 54 45 20 2e 2e 2e |' TOT.S|TATE ...|
|000049e0| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 20 41 43 43 55 |........|... ACCU|
|000049f0| 4d 55 4c 41 54 4f 52 2c | 20 54 4f 54 41 4c 20 53 |MULATOR,| TOTAL S|
|00004a00| 54 41 54 45 20 54 41 58 | 0d 0a 20 20 20 20 20 33 |TATE TAX|.. 3|
|00004a10| 39 30 20 27 0d 0a 20 20 | 20 20 20 34 30 30 20 27 |90 '.. | 400 '|
|00004a20| 20 20 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 20 20 | ******|****** |
|00004a30| 20 44 45 46 49 4e 49 54 | 49 4f 4e 20 4f 46 20 43 | DEFINIT|ION OF C|
|00004a40| 4f 4e 53 54 41 4e 54 53 | 20 20 20 2a 2a 2a 2a 2a |ONSTANTS| *****|
|00004a50| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 0d 0a 20 20 20 20 20 |********|*.. |
|00004a60| 34 31 30 20 27 0d 0a 20 | 20 20 20 20 34 32 30 20 |410 '.. | 420 |
|00004a70| 20 46 45 44 2e 4c 4f 20 | 20 20 20 3d 20 2e 31 38 | FED.LO | = .18|
|00004a80| 0d 0a 20 20 20 20 20 34 | 33 30 20 20 46 45 44 2e |.. 4|30 FED.|
|00004a90| 48 49 20 20 20 20 3d 20 | 2e 32 33 0d 0a 20 20 20 |HI = |.23.. |
|00004aa0| 20 20 34 34 30 20 20 53 | 54 41 54 45 2e 4c 4f 20 | 440 S|TATE.LO |
|00004ab0| 20 3d 20 2e 31 31 0d 0a | 20 20 20 20 20 34 35 30 | = .11..| 450|
|00004ac0| 20 20 53 54 41 54 45 2e | 48 49 20 20 3d 20 2e 31 | STATE.|HI = .1|
|00004ad0| 34 0d 0a 20 20 20 20 20 | 34 36 30 20 20 4c 4f 2e |4.. |460 LO.|
|00004ae0| 54 45 53 54 20 20 20 3d | 20 35 30 30 0d 0a 20 20 |TEST =| 500.. |
|00004af0| 20 20 20 34 37 30 20 20 | 54 4f 54 2e 50 45 4f 50 | 470 |TOT.PEOP|
|00004b00| 20 20 3d 20 30 0d 0a 20 | 20 20 20 20 34 38 30 20 | = 0.. | 480 |
|00004b10| 20 54 4f 54 2e 50 41 59 | 20 20 20 3d 20 30 0d 0a | TOT.PAY| = 0..|
|00004b20| 20 20 20 20 20 34 39 30 | 20 20 54 4f 54 2e 46 45 | 490| TOT.FE|
|00004b30| 44 20 20 20 3d 20 30 0d | 0a 20 20 20 20 20 35 30 |D = 0.|. 50|
|00004b40| 30 20 20 54 4f 54 2e 53 | 54 41 54 45 20 3d 20 30 |0 TOT.S|TATE = 0|
|00004b50| 0d 0a 20 20 20 20 20 35 | 31 30 20 20 46 4d 54 31 |.. 5|10 FMT1|
|00004b60| 24 20 3d 20 22 5c 20 20 | 20 20 20 20 20 20 20 5c |$ = "\ | \|
|00004b70| 20 20 5c 20 20 20 20 20 | 20 20 20 20 20 5c 20 23 | \ | \ #|
|00004b80| 2c 23 23 23 2e 23 23 20 | 20 23 2c 23 23 23 2e 23 |,###.## | #,###.#|
|00004b90| 23 20 20 23 2c 23 23 23 | 2e 23 23 0d 0a 20 20 20 |# #,###|.##.. |
|00004ba0| 20 20 23 2c 23 23 23 2e | 23 23 22 0d 0a 20 20 20 | #,###.|##".. |
|00004bb0| 20 20 35 32 30 20 27 0d | 0a 20 20 20 20 20 35 33 | 520 '.|. 53|
|00004bc0| 30 20 27 20 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |0 ' ***|********|
|00004bd0| 2a 2a 2a 2a 2a 2a 2a 2a | 20 20 20 50 52 4f 43 45 |********| PROCE|
|00004be0| 53 53 49 4e 47 20 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |SSING *|********|
|00004bf0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00004c00| 0a 20 20 20 20 20 35 34 | 30 20 27 0d 0a 20 20 20 |. 54|0 '.. |
|00004c10| 20 20 35 35 30 20 50 52 | 49 4e 54 20 54 41 42 28 | 550 PR|INT TAB(|
|00004c20| 32 32 29 3b 20 22 57 45 | 45 4b 4c 59 20 50 41 59 |22); "WE|EKLY PAY|
|00004c30| 52 4f 4c 4c 20 50 52 4f | 47 52 41 4d 22 0d 0a 20 |ROLL PRO|GRAM".. |
|00004c40| 20 20 20 20 35 36 30 20 | 50 52 49 4e 54 0d 0a 20 | 560 |PRINT.. |
|00004c50| 20 20 20 20 35 37 30 20 | 50 52 49 4e 54 20 22 4c | 570 |PRINT "L|
|00004c60| 41 53 54 20 4e 41 4d 45 | 20 20 20 20 20 20 20 20 |AST NAME| |
|00004c70| 53 53 4e 20 20 20 20 20 | 20 20 20 20 47 52 4f 53 |SSN | GROS|
|00004c80| 53 20 20 20 46 45 44 45 | 52 41 4c 20 20 20 53 54 |S FEDE|RAL ST|
|00004c90| 41 54 45 20 20 20 20 20 | 4e 45 54 22 0d 0a 20 20 |ATE |NET".. |
|00004ca0| 20 20 20 35 38 30 20 50 | 52 49 4e 54 20 22 20 20 | 580 P|RINT " |
|00004cb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004cc0| 20 20 20 20 20 20 20 20 | 20 20 53 41 4c 41 52 59 | | SALARY|
|00004cd0| 20 20 20 20 20 54 41 58 | 20 20 20 20 20 20 54 41 | TAX| TA|
|00004ce0| 58 20 20 20 53 41 4c 41 | 52 59 22 0d 0a 20 20 20 |X SALA|RY".. |
|00004cf0| 20 20 35 39 30 20 50 52 | 49 4e 54 20 22 2d 2d 2d | 590 PR|INT "---|
|00004d00| 2d 2d 2d 2d 2d 2d 20 20 | 20 20 20 2d 2d 2d 2d 2d |------ | -----|
|00004d10| 2d 2d 2d 2d 20 20 20 20 | 20 2d 2d 2d 2d 2d 2d 20 |---- | ------ |
|00004d20| 20 20 2d 2d 2d 2d 2d 2d | 2d 20 20 20 2d 2d 2d 2d | ------|- ----|
|00004d30| 2d 20 20 2d 2d 2d 2d 2d | 2d 22 0d 0a 20 20 20 20 |- -----|-".. |
|00004d40| 20 36 30 30 20 50 52 49 | 4e 54 0d 0a 0d 0a 0d 0a | 600 PRI|NT......|
|00004d50| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00004d60| 20 20 20 1b 45 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00004d70| 20 20 20 20 20 1b 46 20 | 20 20 20 20 1b 45 20 20 | .F | .E |
|00004d80| 33 32 0d 0a 0d 0a 0c 0d | 0a 0d 0a 0d 0a 0d 0a 1b |32......|........|
|00004d90| 46 20 20 20 20 20 1b 45 | 43 48 41 50 54 45 52 20 |F .E|CHAPTER |
|00004da0| 33 1b 46 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |3.F | |
|00004db0| 20 1b 45 20 43 4c 45 41 | 4e 49 4e 47 20 55 50 20 | .E CLEA|NING UP |
|00004dc0| 54 48 45 20 41 43 54 1b | 46 20 1b 45 20 20 20 1b |THE ACT.|F .E .|
|00004dd0| 46 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |F | |
|00004de0| 20 1b 45 43 48 41 50 54 | 45 52 20 33 0d 0a 0d 0a | .ECHAPT|ER 3....|
|00004df0| 0d 0a 20 20 20 20 20 1b | 46 54 68 65 20 49 46 2f |.. .|FThe IF/|
|00004e00| 54 48 45 4e 2f 45 4c 53 | 45 20 6c 6f 67 69 63 20 |THEN/ELS|E logic |
|00004e10| 66 6f 6c 6c 6f 77 73 20 | 74 68 65 20 57 48 49 4c |follows |the WHIL|
|00004e20| 45 20 69 6e 73 74 72 75 | 63 74 69 6f 6e 2e 20 20 |E instru|ction. |
|00004e30| 57 65 20 69 6e 64 65 6e | 74 20 74 68 69 73 0d 0a |We inden|t this..|
|00004e40| 20 20 20 20 20 6c 6f 67 | 69 63 20 74 6f 20 6d 61 | log|ic to ma|
|00004e50| 6b 65 20 69 74 20 65 61 | 73 69 65 72 20 74 6f 20 |ke it ea|sier to |
|00004e60| 74 65 6c 6c 20 77 68 65 | 72 65 20 74 68 65 20 63 |tell whe|re the c|
|00004e70| 6f 6e 64 69 74 69 6f 6e | 61 6c 20 70 61 72 74 20 |ondition|al part |
|00004e80| 73 74 61 72 74 73 20 61 | 6e 64 0d 0a 20 20 20 20 |starts a|nd.. |
|00004e90| 20 65 6e 64 73 2e 20 20 | 4e 6f 74 65 20 74 68 61 | ends. |Note tha|
|00004ea0| 74 20 6f 6e 6c 79 20 6f | 6e 65 20 74 65 73 74 20 |t only o|ne test |
|00004eb0| 69 73 20 6e 65 65 64 65 | 64 2e 20 20 41 6c 73 6f |is neede|d. Also|
|00004ec0| 20 6e 6f 74 65 20 74 68 | 61 74 20 74 68 65 20 3e | note th|at the >|
|00004ed0| 3d 20 4c 4f 2e 54 45 53 | 54 0d 0a 20 20 20 20 20 |= LO.TES|T.. |
|00004ee0| 63 6f 6e 64 69 74 69 6f | 6e 20 66 6f 6c 6c 6f 77 |conditio|n follow|
|00004ef0| 73 20 74 68 65 20 45 4c | 53 45 20 73 74 61 74 65 |s the EL|SE state|
|00004f00| 6d 65 6e 74 20 62 79 20 | 64 65 66 61 75 6c 74 2e |ment by |default.|
|00004f10| 0d 0a 0d 0a 20 20 20 20 | 20 46 6f 72 73 6f 6f 74 |.... | Forsoot|
|00004f20| 68 2c 20 74 68 65 72 65 | 20 61 72 65 20 6e 6f 20 |h, there| are no |
|00004f30| 6c 69 6e 65 20 6e 75 6d | 62 65 72 73 20 69 6e 20 |line num|bers in |
|00004f40| 66 72 6f 6e 74 20 6f 66 | 20 74 68 65 20 54 48 45 |front of| the THE|
|00004f50| 4e 20 61 6e 64 20 45 4c | 53 45 0d 0a 20 20 20 20 |N and EL|SE.. |
|00004f60| 20 70 69 65 63 65 73 2c | 20 61 6e 64 20 77 68 61 | pieces,| and wha|
|00004f70| 74 20 61 72 65 20 74 68 | 6f 73 65 20 66 75 6e 6e |t are th|ose funn|
|00004f80| 79 20 3a 27 73 20 64 6f | 69 6e 67 20 74 68 65 72 |y :'s do|ing ther|
|00004f90| 65 3f 20 20 55 6e 64 65 | 72 20 42 41 53 49 43 41 |e? Unde|r BASICA|
|00004fa0| 2c 20 61 20 6c 69 6e 65 | 0d 0a 20 20 20 20 20 63 |, a line|.. c|
|00004fb0| 61 6e 20 68 61 76 65 20 | 75 70 20 74 6f 20 32 35 |an have |up to 25|
|00004fc0| 35 20 63 68 61 72 61 63 | 74 65 72 73 2e 20 20 54 |5 charac|ters. T|
|00004fd0| 68 65 20 63 75 72 73 6f | 72 20 77 72 61 70 73 2e |he curso|r wraps.|
|00004fe0| 20 20 57 65 20 74 61 6b | 65 20 61 64 76 61 6e 74 | We tak|e advant|
|00004ff0| 61 67 65 20 6f 66 0d 0a | 20 20 20 20 20 74 68 69 |age of..| thi|
|00005000| 73 20 62 79 20 74 79 70 | 69 6e 67 20 6f 75 74 20 |s by typ|ing out |
|00005010| 6c 69 6e 65 20 36 35 30 | 20 61 6e 64 20 74 68 65 |line 650| and the|
|00005020| 6e 20 61 64 64 69 6e 67 | 20 73 70 61 63 65 73 20 |n adding| spaces |
|00005030| 75 6e 74 69 6c 20 74 68 | 65 20 6c 69 6e 65 20 77 |until th|e line w|
|00005040| 72 61 70 73 2e 0d 0a 20 | 20 20 20 20 54 68 65 20 |raps... | The |
|00005050| 54 48 45 4e 20 69 73 20 | 6f 66 66 73 65 74 20 61 |THEN is |offset a|
|00005060| 6e 64 20 74 68 65 20 63 | 6f 6e 64 69 74 69 6f 6e |nd the c|ondition|
|00005070| 61 6c 20 6c 6f 67 69 63 | 20 66 6f 6c 6c 6f 77 73 |al logic| follows|
|00005080| 2e 20 20 4e 6f 74 69 63 | 65 20 74 68 61 74 20 77 |. Notic|e that w|
|00005090| 65 0d 0a 20 20 20 20 20 | 63 6f 6d 62 69 6e 65 20 |e.. |combine |
|000050a0| 6d 75 6c 74 69 70 6c 65 | 20 69 6e 73 74 72 75 63 |multiple| instruc|
|000050b0| 74 69 6f 6e 73 20 6f 6e | 20 74 68 65 20 73 61 6d |tions on| the sam|
|000050c0| 65 20 6c 69 6e 65 2c 0d | 0a 0d 0a 20 20 20 20 20 |e line,.|... |
|000050d0| 20 20 20 20 54 48 45 4e | 20 20 46 45 44 2e 54 41 | THEN| FED.TA|
|000050e0| 58 20 3d 20 47 52 4f 53 | 53 2e 50 41 59 2a 46 45 |X = GROS|S.PAY*FE|
|000050f0| 44 2e 4c 4f 3a 20 53 54 | 41 54 45 2e 54 41 58 20 |D.LO: ST|ATE.TAX |
|00005100| 3d 47 52 4f 53 53 2e 50 | 41 59 2a 53 54 41 54 45 |=GROSS.P|AY*STATE|
|00005110| 2e 4c 4f 29 0d 0a 0d 0a | 20 20 20 20 20 65 2e 67 |.LO)....| e.g|
|00005120| 2e 20 77 65 20 63 6f 6d | 70 75 74 65 20 46 45 44 |. we com|pute FED|
|00005130| 2e 54 41 58 20 61 6e 64 | 20 47 52 4f 53 53 2e 50 |.TAX and| GROSS.P|
|00005140| 41 59 2e 20 20 59 6f 75 | 20 61 63 63 6f 6d 70 6c |AY. You| accompl|
|00005150| 69 73 68 20 74 68 69 73 | 20 62 79 0d 0a 20 20 20 |ish this| by.. |
|00005160| 20 20 73 65 70 61 72 61 | 74 69 6e 67 20 74 68 65 | separa|ting the|
|00005170| 20 69 6e 73 74 72 75 63 | 74 69 6f 6e 73 20 77 69 | instruc|tions wi|
|00005180| 74 68 20 63 6f 6c 6f 6e | 73 2e 20 20 42 41 53 49 |th colon|s. BASI|
|00005190| 43 20 65 78 70 65 63 74 | 73 20 6f 6e 6c 79 20 6f |C expect|s only o|
|000051a0| 6e 65 0d 0a 20 20 20 20 | 20 69 6e 73 74 72 75 63 |ne.. | instruc|
|000051b0| 74 69 6f 6e 20 61 66 74 | 65 72 20 74 68 65 20 54 |tion aft|er the T|
|000051c0| 48 45 4e 2c 20 74 68 65 | 20 3a 20 74 65 6c 6c 73 |HEN, the| : tells|
|000051d0| 20 69 74 20 61 6e 6f 74 | 68 65 72 20 66 6f 6c 6c | it anot|her foll|
|000051e0| 6f 77 73 20 74 68 65 20 | 66 69 72 73 74 2e 0d 0a |ows the |first...|
|000051f0| 20 20 20 20 20 54 68 65 | 20 63 6f 6c 6f 6e 20 72 | The| colon r|
|00005200| 65 70 6c 61 63 65 73 20 | 6c 69 6e 65 20 6e 75 6d |eplaces |line num|
|00005210| 62 65 72 73 20 61 6e 64 | 20 70 65 72 6d 69 74 73 |bers and| permits|
|00005220| 20 75 73 20 74 6f 20 70 | 75 74 20 73 65 76 65 72 | us to p|ut sever|
|00005230| 61 6c 0d 0a 20 20 20 20 | 20 69 6e 73 74 72 75 63 |al.. | instruc|
|00005240| 74 69 6f 6e 73 20 6f 6e | 20 74 68 65 20 73 61 6d |tions on| the sam|
|00005250| 65 20 6c 69 6e 65 2e 20 | 20 49 6e 20 74 68 69 73 |e line. | In this|
|00005260| 20 63 61 73 65 2c 20 69 | 74 20 73 61 76 65 73 20 | case, i|t saves |
|00005270| 74 68 72 65 65 20 49 46 | 20 74 65 73 74 73 2e 0d |three IF| tests..|
|00005280| 0a 20 20 20 20 20 41 73 | 73 75 6d 65 20 74 68 61 |. As|sume tha|
|00005290| 74 20 74 68 69 73 20 77 | 61 73 20 61 20 72 65 61 |t this w|as a rea|
|000052a0| 6c 20 70 72 6f 64 75 63 | 74 69 6f 6e 20 70 72 6f |l produc|tion pro|
|000052b0| 67 72 61 6d 20 74 68 61 | 74 20 70 72 6f 63 65 73 |gram tha|t proces|
|000052c0| 73 65 64 20 35 30 30 2c | 30 30 30 0d 0a 20 20 20 |sed 500,|000.. |
|000052d0| 20 20 6e 61 6d 65 73 20 | 64 75 72 69 6e 67 20 74 | names |during t|
|000052e0| 68 65 20 6e 69 67 68 74 | 2e 20 20 59 6f 75 20 68 |he night|. You h|
|000052f0| 61 76 65 20 6a 75 73 74 | 20 65 6c 69 6d 69 6e 61 |ave just| elimina|
|00005300| 74 65 64 20 20 6f 6e 65 | 20 61 6e 64 20 61 20 68 |ted one| and a h|
|00005310| 61 6c 66 0d 0a 20 20 20 | 20 20 6d 69 6c 6c 69 6f |alf.. | millio|
|00005320| 6e 20 49 46 20 74 65 73 | 74 73 2e 0d 0a 0d 0a 20 |n IF tes|ts..... |
|00005330| 20 20 20 20 4e 6f 74 68 | 69 6e 67 20 77 6f 72 6b | Noth|ing work|
|00005340| 73 20 61 73 20 6e 65 61 | 74 6c 79 20 61 73 20 74 |s as nea|tly as t|
|00005350| 65 78 74 62 6f 6f 6b 20 | 65 78 61 6d 70 6c 65 73 |extbook |examples|
|00005360| 20 6d 61 6b 65 20 69 74 | 20 61 70 70 65 61 72 2e | make it| appear.|
|00005370| 20 20 59 6f 75 20 6d 61 | 79 0d 0a 20 20 20 20 20 | You ma|y.. |
|00005380| 6e 6f 74 20 61 6c 77 61 | 79 73 20 62 65 20 61 62 |not alwa|ys be ab|
|00005390| 6c 65 20 74 6f 20 61 6c | 69 67 6e 20 79 6f 75 20 |le to al|ign you |
|000053a0| 63 6f 64 65 20 74 68 69 | 73 20 63 6c 65 61 6e 6c |code thi|s cleanl|
|000053b0| 79 2e 20 20 49 74 27 73 | 20 61 20 6a 75 64 67 6d |y. It's| a judgm|
|000053c0| 65 6e 74 0d 0a 20 20 20 | 20 20 63 61 6c 6c 2e 20 |ent.. | call. |
|000053d0| 20 57 68 65 6e 20 79 6f | 75 20 68 61 76 65 20 74 | When yo|u have t|
|000053e0| 68 65 20 6f 70 70 6f 72 | 74 75 6e 69 74 79 2c 20 |he oppor|tunity, |
|000053f0| 68 6f 77 65 76 65 72 2c | 20 64 6f 20 73 6f 2e 0d |however,| do so..|
|00005400| 0a 0d 0a 20 20 20 20 20 | 36 31 30 20 52 45 41 44 |... |610 READ|
|00005410| 20 4c 41 53 54 2e 4e 41 | 4d 45 24 2c 20 53 53 4e | LAST.NA|ME$, SSN|
|00005420| 24 2c 20 47 52 4f 53 53 | 2e 50 41 59 0d 0a 20 20 |$, GROSS|.PAY.. |
|00005430| 20 20 20 36 32 30 20 27 | 0d 0a 20 20 20 20 20 36 | 620 '|.. 6|
|00005440| 33 30 20 57 48 49 4c 45 | 20 4c 41 53 54 2e 4e 41 |30 WHILE| LAST.NA|
|00005450| 4d 45 24 20 3c 3e 20 22 | 55 4e 43 4c 45 22 0d 0a |ME$ <> "|UNCLE"..|
|00005460| 20 20 20 20 20 36 34 30 | 20 27 0d 0a 20 20 20 20 | 640| '.. |
|00005470| 20 36 35 30 20 20 20 20 | 49 46 20 47 52 4f 53 53 | 650 |IF GROSS|
|00005480| 2e 50 41 59 20 3c 20 4c | 4f 2e 54 45 53 54 0d 0a |.PAY < L|O.TEST..|
|00005490| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 54 | | T|
|000054a0| 48 45 4e 20 20 46 45 44 | 2e 54 41 58 20 3d 20 47 |HEN FED|.TAX = G|
|000054b0| 52 4f 53 53 2e 50 41 59 | 2a 46 45 44 2e 4c 4f 3a |ROSS.PAY|*FED.LO:|
|000054c0| 20 53 54 41 54 45 2e 54 | 41 58 20 3d 0d 0a 20 20 | STATE.T|AX =.. |
|000054d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 47 52 4f | | GRO|
|000054e0| 53 53 2e 50 41 59 2a 53 | 54 41 54 45 2e 4c 4f 0d |SS.PAY*S|TATE.LO.|
|000054f0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00005500| 45 4c 53 45 20 20 46 45 | 44 2e 54 41 58 20 3d 20 |ELSE FE|D.TAX = |
|00005510| 47 52 4f 53 53 2e 50 41 | 59 2a 46 45 44 2e 48 49 |GROSS.PA|Y*FED.HI|
|00005520| 3a 20 53 54 41 54 45 2e | 54 41 58 20 3d 0d 0a 20 |: STATE.|TAX =.. |
|00005530| 20 20 20 20 1b 45 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00005540| 1b 46 47 52 4f 53 53 2e | 50 41 59 2a 53 54 41 54 |.FGROSS.|PAY*STAT|
|00005550| 45 2e 48 49 0d 0a 20 20 | 20 20 20 36 36 30 20 27 |E.HI.. | 660 '|
|00005560| 0d 0a 20 20 20 20 20 36 | 37 30 20 20 20 20 4e 45 |.. 6|70 NE|
|00005570| 54 2e 50 41 59 20 20 20 | 3d 20 47 52 4f 53 53 2e |T.PAY |= GROSS.|
|00005580| 50 41 59 20 2d 20 28 46 | 45 44 2e 54 41 58 20 2b |PAY - (F|ED.TAX +|
|00005590| 20 53 54 41 54 45 2e 54 | 41 58 29 0d 0a 20 20 20 | STATE.T|AX).. |
|000055a0| 20 20 36 38 30 20 20 20 | 20 54 4f 54 2e 50 45 4f | 680 | TOT.PEO|
|000055b0| 50 20 20 3d 20 54 4f 54 | 2e 50 45 4f 50 2b 31 0d |P = TOT|.PEOP+1.|
|000055c0| 0a 20 20 20 20 20 36 39 | 30 20 20 20 20 54 4f 54 |. 69|0 TOT|
|000055d0| 2e 50 41 59 20 20 20 3d | 20 54 4f 54 2e 50 41 59 |.PAY =| TOT.PAY|
|000055e0| 20 2b 20 47 52 4f 53 53 | 2e 50 41 59 0d 0a 20 20 | + GROSS|.PAY.. |
|000055f0| 20 20 20 37 30 30 20 20 | 20 20 54 4f 54 2e 46 45 | 700 | TOT.FE|
|00005600| 44 20 20 20 3d 20 54 4f | 54 2e 46 45 44 20 2b 20 |D = TO|T.FED + |
|00005610| 46 45 44 2e 54 41 58 0d | 0a 20 20 20 20 20 37 31 |FED.TAX.|. 71|
|00005620| 30 20 20 20 20 54 4f 54 | 2e 53 54 41 54 45 20 3d |0 TOT|.STATE =|
|00005630| 20 54 4f 54 2e 53 54 41 | 54 45 20 2b 20 53 54 41 | TOT.STA|TE + STA|
|00005640| 54 45 2e 54 41 58 0d 0a | 20 20 20 20 20 37 32 30 |TE.TAX..| 720|
|00005650| 27 0d 0a 20 20 20 20 20 | 37 33 30 20 20 20 20 50 |'.. |730 P|
|00005660| 52 49 4e 54 20 55 53 49 | 4e 47 20 46 4d 54 31 24 |RINT USI|NG FMT1$|
|00005670| 3b 20 4c 41 53 54 2e 4e | 41 4d 45 24 2c 20 53 53 |; LAST.N|AME$, SS|
|00005680| 4e 24 2c 20 47 52 4f 53 | 53 2e 50 41 59 2c 20 46 |N$, GROS|S.PAY, F|
|00005690| 45 44 2e 54 41 58 2c 0d | 0a 20 20 20 20 20 20 20 |ED.TAX,.|. |
|000056a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000056b0| 20 20 20 20 20 20 20 20 | 53 54 41 54 45 2e 54 41 | |STATE.TA|
|000056c0| 58 2c 20 4e 45 54 2e 50 | 41 59 0d 0a 20 20 20 20 |X, NET.P|AY.. |
|000056d0| 20 37 34 30 20 20 20 20 | 52 45 41 44 20 20 4c 41 | 740 |READ LA|
|000056e0| 53 54 2e 4e 41 4d 45 24 | 2c 20 20 53 53 4e 24 2c |ST.NAME$|, SSN$,|
|000056f0| 20 47 52 4f 53 53 2e 50 | 41 59 0d 0a 20 20 20 20 | GROSS.P|AY.. |
|00005700| 20 37 35 30 20 27 0d 0a | 20 20 20 20 20 37 36 30 | 750 '..| 760|
|00005710| 20 57 45 4e 44 0d 0a 20 | 20 20 20 20 37 37 30 20 | WEND.. | 770 |
|00005720| 50 52 49 4e 54 0d 0a 20 | 20 20 20 20 37 38 30 20 |PRINT.. | 780 |
|00005730| 50 52 49 4e 54 20 22 54 | 4f 54 41 4c 20 4f 4e 20 |PRINT "T|OTAL ON |
|00005740| 50 41 59 52 4f 4c 4c 3a | 20 20 20 22 3b 54 4f 54 |PAYROLL:| ";TOT|
|00005750| 2e 50 45 4f 50 0d 0a 20 | 20 20 20 20 37 39 30 20 |.PEOP.. | 790 |
|00005760| 50 52 49 4e 54 20 22 54 | 4f 54 41 4c 20 4f 46 20 |PRINT "T|OTAL OF |
|00005770| 50 41 59 52 4f 4c 4c 3a | 20 20 20 22 3b 54 4f 54 |PAYROLL:| ";TOT|
|00005780| 2e 50 41 59 0d 0a 20 20 | 20 20 20 38 30 30 20 50 |.PAY.. | 800 P|
|00005790| 52 49 4e 54 20 22 54 4f | 54 41 4c 20 46 45 44 45 |RINT "TO|TAL FEDE|
|000057a0| 52 41 4c 20 54 41 58 3a | 20 20 22 3b 54 4f 54 2e |RAL TAX:| ";TOT.|
|000057b0| 46 45 44 0d 0a 20 20 20 | 20 20 38 31 30 20 50 52 |FED.. | 810 PR|
|000057c0| 49 4e 54 20 22 54 4f 54 | 41 4c 20 53 54 41 54 45 |INT "TOT|AL STATE|
|000057d0| 20 54 41 58 3a 20 20 20 | 20 22 3b 54 4f 54 2e 53 | TAX: | ";TOT.S|
|000057e0| 54 41 54 45 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 20 |TATE....|.. |
|000057f0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 20 20 20 | | .E |
|00005800| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 46 20 | | .F |
|00005810| 20 20 20 20 1b 45 20 20 | 33 33 0d 0a 0d 0a 0c 0d | .E |33......|
|00005820| 0a 0d 0a 0d 0a 0d 0a 1b | 46 20 20 20 20 20 1b 45 |........|F .E|
|00005830| 43 48 41 50 54 45 52 20 | 33 1b 46 20 20 20 20 20 |CHAPTER |3.F |
|00005840| 20 20 20 20 20 20 20 20 | 20 1b 45 20 43 4c 45 41 | | .E CLEA|
|00005850| 4e 49 4e 47 20 55 50 20 | 54 48 45 20 41 43 54 1b |NING UP |THE ACT.|
|00005860| 46 20 1b 45 20 20 20 1b | 46 20 20 20 20 20 20 20 |F .E .|F |
|00005870| 20 20 20 20 20 20 20 20 | 20 1b 45 43 48 41 50 54 | | .ECHAPT|
|00005880| 45 52 20 33 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 1b |ER 3....|.. .|
|00005890| 46 38 32 30 20 50 52 49 | 4e 54 0d 0a 20 20 20 20 |F820 PRI|NT.. |
|000058a0| 20 38 33 30 20 27 0d 0a | 20 20 20 20 20 38 34 30 | 830 '..| 840|
|000058b0| 20 27 20 20 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ' ****|********|
|000058c0| 2a 2a 20 20 20 49 4e 50 | 55 54 20 44 41 54 41 20 |** INP|UT DATA |
|000058d0| 20 20 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ******|********|
|000058e0| 2a 2a 0d 0a 20 20 20 20 | 20 38 35 30 20 27 0d 0a |**.. | 850 '..|
|000058f0| 20 20 20 20 20 38 36 30 | 20 44 41 54 41 20 53 4d | 860| DATA SM|
|00005900| 49 4c 45 59 2c 31 31 31 | 2d 31 31 2d 31 31 31 31 |ILEY,111|-11-1111|
|00005910| 2c 32 33 34 2e 30 30 0d | 0a 20 20 20 20 20 38 37 |,234.00.|. 87|
|00005920| 30 20 44 41 54 41 20 44 | 4f 50 45 59 2c 32 32 32 |0 DATA D|OPEY,222|
|00005930| 2d 32 32 2d 32 32 32 32 | 2c 34 39 39 2e 30 30 0d |-22-2222|,499.00.|
|00005940| 0a 20 20 20 20 20 38 38 | 30 20 44 41 54 41 20 47 |. 88|0 DATA G|
|00005950| 52 55 4d 50 59 2c 33 33 | 33 2d 33 33 2d 33 33 33 |RUMPY,33|3-33-333|
|00005960| 33 2c 35 30 30 2e 30 30 | 0d 0a 20 20 20 20 20 38 |3,500.00|.. 8|
|00005970| 39 30 20 44 41 54 41 20 | 44 4f 43 2c 34 34 34 2d |90 DATA |DOC,444-|
|00005980| 34 34 2d 34 34 34 34 2c | 31 32 30 30 2e 30 30 0d |44-4444,|1200.00.|
|00005990| 0a 20 20 20 20 20 39 30 | 30 20 44 41 54 41 20 53 |. 90|0 DATA S|
|000059a0| 4e 4f 57 48 49 54 45 2c | 39 39 39 2d 39 39 2d 39 |NOWHITE,|999-99-9|
|000059b0| 39 39 39 2c 35 34 30 30 | 2e 30 31 0d 0a 20 20 20 |999,5400|.01.. |
|000059c0| 20 20 39 31 30 20 44 41 | 54 41 20 55 4e 43 4c 45 | 910 DA|TA UNCLE|
|000059d0| 2c 53 41 4d 2c 30 0d 0a | 20 20 20 20 20 39 32 30 |,SAM,0..| 920|
|000059e0| 20 53 54 4f 50 0d 0a 20 | 20 20 20 20 39 33 30 20 | STOP.. | 930 |
|000059f0| 45 4e 44 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 54 68 |END.....|. Th|
|00005a00| 65 20 57 48 49 4c 45 20 | 6c 6f 6f 70 20 68 61 73 |e WHILE |loop has|
|00005a10| 20 64 6f 75 62 6c 65 20 | 69 6e 64 65 6e 74 61 74 | double |indentat|
|00005a20| 69 6f 6e 3b 20 6f 6e 65 | 20 66 6f 72 20 74 68 65 |ion; one| for the|
|00005a30| 20 57 48 49 4c 45 2c 20 | 61 6e 64 20 61 6e 6f 74 | WHILE, |and anot|
|00005a40| 68 65 72 0d 0a 20 20 20 | 20 20 66 6f 72 20 74 68 |her.. | for th|
|00005a50| 65 20 49 46 2f 54 48 45 | 4e 2f 45 4c 53 45 2e 20 |e IF/THE|N/ELSE. |
|00005a60| 20 52 65 76 69 65 77 20 | 74 68 65 20 74 65 73 74 | Review |the test|
|00005a70| 69 6e 67 20 61 6e 64 20 | 6c 6f 67 69 63 20 66 6f |ing and |logic fo|
|00005a80| 72 20 74 68 65 20 49 46 | 2f 54 48 45 4e 2f 45 4c |r the IF|/THEN/EL|
|00005a90| 53 45 0d 0a 20 20 20 20 | 20 73 74 72 75 63 74 75 |SE.. | structu|
|00005aa0| 72 65 20 61 6e 64 20 6e | 6f 74 65 20 68 6f 77 20 |re and n|ote how |
|00005ab0| 69 74 20 73 69 6d 70 6c | 69 66 69 65 73 20 74 68 |it simpl|ifies th|
|00005ac0| 65 20 63 6f 64 65 2e 20 | 20 4f 6e 63 65 20 79 6f |e code. | Once yo|
|00005ad0| 75 20 74 65 73 74 20 6f | 6e 20 61 0d 0a 20 20 20 |u test o|n a.. |
|00005ae0| 20 20 63 6f 6e 64 69 74 | 69 6f 6e 20 28 47 52 4f | condit|ion (GRO|
|00005af0| 53 53 2e 50 41 59 20 3c | 20 4c 4f 2e 54 45 53 54 |SS.PAY <| LO.TEST|
|00005b00| 20 66 6f 72 20 65 78 61 | 6d 70 6c 65 29 2c 20 6f | for exa|mple), o|
|00005b10| 6e 6c 79 20 74 68 65 20 | 6c 6f 67 69 63 20 74 68 |nly the |logic th|
|00005b20| 61 74 0d 0a 20 20 20 20 | 20 70 65 72 74 61 69 6e |at.. | pertain|
|00005b30| 73 20 74 6f 20 74 68 61 | 74 20 63 6f 6e 64 69 74 |s to tha|t condit|
|00005b40| 69 6f 6e 20 69 73 20 65 | 78 65 63 75 74 65 64 20 |ion is e|xecuted |
|00005b50| 69 66 20 69 74 27 73 20 | 74 72 75 65 2e 20 20 49 |if it's |true. I|
|00005b60| 66 20 69 74 27 73 20 6e | 6f 74 20 74 72 75 65 2c |f it's n|ot true,|
|00005b70| 0d 0a 20 20 20 20 20 74 | 68 65 6e 20 74 68 65 20 |.. t|hen the |
|00005b80| 45 4c 53 45 20 70 6f 72 | 74 69 6f 6e 20 6f 66 20 |ELSE por|tion of |
|00005b90| 74 68 65 20 73 74 72 75 | 63 74 75 72 65 20 63 75 |the stru|cture cu|
|00005ba0| 74 73 20 69 6e 20 61 6e | 64 20 74 68 65 20 72 65 |ts in an|d the re|
|00005bb0| 73 74 20 6f 66 20 74 68 | 65 20 63 6f 64 65 0d 0a |st of th|e code..|
|00005bc0| 20 20 20 20 20 61 70 70 | 6c 69 65 73 20 62 79 20 | app|lies by |
|00005bd0| 64 65 66 61 75 6c 74 2e | 20 20 54 68 65 20 65 6e |default.| The en|
|00005be0| 64 20 6f 66 20 74 68 65 | 20 63 6f 6e 64 69 74 69 |d of the| conditi|
|00005bf0| 6f 6e 61 6c 20 6c 6f 67 | 69 63 20 69 73 20 74 68 |onal log|ic is th|
|00005c00| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 0d 0a 20 20 |e end of| the.. |
|00005c10| 20 20 20 6c 69 6e 65 20 | 28 74 68 65 20 32 35 35 | line |(the 255|
|00005c20| 20 63 68 61 72 61 63 74 | 65 72 20 6c 69 6e 65 29 | charact|er line)|
|00005c30| 2e 0d 0a 0d 0a 20 20 20 | 20 20 4e 6f 77 2c 20 74 |..... | Now, t|
|00005c40| 6f 20 68 65 6c 70 20 79 | 6f 75 20 70 72 61 63 74 |o help y|ou pract|
|00005c50| 69 63 65 20 77 68 61 74 | 20 77 65 20 70 72 65 61 |ice what| we prea|
|00005c60| 63 68 2c 20 6f 75 72 20 | 66 72 69 65 6e 64 20 74 |ch, our |friend t|
|00005c70| 68 65 20 73 79 73 74 65 | 6d 73 20 61 6e 61 6c 79 |he syste|ms analy|
|00005c80| 73 74 0d 0a 20 20 20 20 | 20 68 61 73 20 61 6e 20 |st.. | has an |
|00005c90| 65 78 65 72 63 69 73 65 | 20 66 6f 72 20 79 6f 75 |exercise| for you|
|00005ca0| 2e 20 20 44 6f 65 73 6e | 27 74 20 74 68 69 73 20 |. Doesn|'t this |
|00005cb0| 73 6f 75 6e 64 20 6c 69 | 6b 65 20 44 69 63 6b 2c |sound li|ke Dick,|
|00005cc0| 20 4a 61 6e 65 20 61 6e | 64 20 53 70 6f 74 0d 0a | Jane an|d Spot..|
|00005cd0| 20 20 20 20 20 73 68 6f | 75 6c 64 20 62 65 20 70 | sho|uld be p|
|00005ce0| 6f 70 70 69 6e 67 20 75 | 70 20 61 74 20 61 6e 79 |opping u|p at any|
|00005cf0| 20 6d 6f 6d 65 6e 74 3f | 20 20 53 74 61 79 20 74 | moment?| Stay t|
|00005d00| 75 6e 65 64 2c 20 77 68 | 6f 20 6b 6e 6f 77 73 2c |uned, wh|o knows,|
|00005d10| 20 61 6e 64 20 69 6e 20 | 74 68 65 0d 0a 20 20 20 | and in |the.. |
|00005d20| 20 20 6d 65 61 6e 20 74 | 69 6d 65 20 74 75 72 6e | mean t|ime turn|
|00005d30| 20 74 6f 20 74 68 65 20 | 6e 65 78 74 20 70 61 67 | to the |next pag|
|00005d40| 65 20 61 6e 64 20 70 72 | 6f 67 72 61 6d 20 79 6f |e and pr|ogram yo|
|00005d50| 75 72 20 68 65 61 72 74 | 20 6f 75 74 2e 0d 0a 0d |ur heart| out....|
|00005d60| 0a 0d 0a 20 20 20 20 20 | 1b 45 53 50 45 43 49 46 |... |.ESPECIF|
|00005d70| 49 43 41 54 49 4f 4e 0d | 0a 0d 0a 20 20 20 20 20 |ICATION.|... |
|00005d80| 1b 46 54 68 65 20 53 65 | 65 64 79 20 4c 61 77 6e |.FThe Se|edy Lawn|
|00005d90| 20 43 6f 6d 70 61 6e 79 | 20 69 73 20 6c 6f 73 69 | Company| is losi|
|00005da0| 6e 67 20 74 68 65 69 72 | 20 65 73 74 69 6d 61 74 |ng their| estimat|
|00005db0| 6f 72 20 22 43 72 61 62 | 73 22 20 47 72 61 73 73 |or "Crab|s" Grass|
|00005dc0| 20 61 6e 64 20 74 68 65 | 79 0d 0a 20 20 20 20 20 | and the|y.. |
|00005dd0| 77 61 6e 74 20 74 6f 20 | 72 65 70 6c 61 63 65 20 |want to |replace |
|00005de0| 68 69 6d 20 77 69 74 68 | 20 61 20 63 6f 6d 70 75 |him with| a compu|
|00005df0| 74 65 72 2e 20 20 59 6f | 75 72 20 6a 6f 62 20 69 |ter. Yo|ur job i|
|00005e00| 73 20 74 6f 20 77 72 69 | 74 65 20 74 68 65 0d 0a |s to wri|te the..|
|00005e10| 20 20 20 20 20 65 73 74 | 69 6d 61 74 69 6e 67 20 | est|imating |
|00005e20| 70 72 6f 67 72 61 6d 20 | 69 6e 20 73 74 72 75 63 |program |in struc|
|00005e30| 74 75 72 65 64 20 42 41 | 53 49 43 20 75 73 69 6e |tured BA|SIC usin|
|00005e40| 67 20 49 46 2d 54 48 45 | 4e 2d 45 4c 53 45 27 73 |g IF-THE|N-ELSE's|
|00005e50| 2e 20 20 54 68 69 73 20 | 74 61 73 6b 0d 0a 20 20 |. This |task.. |
|00005e60| 20 20 20 69 73 20 73 69 | 6d 70 6c 69 66 69 65 64 | is si|mplified|
|00005e70| 20 73 6f 6d 65 77 68 61 | 74 20 62 79 20 74 68 65 | somewha|t by the|
|00005e80| 20 66 61 63 74 20 74 68 | 61 74 20 22 43 72 61 62 | fact th|at "Crab|
|00005e90| 73 22 20 63 6f 75 6c 64 | 20 6f 6e 6c 79 20 63 61 |s" could| only ca|
|00005ea0| 6c 63 75 6c 61 74 65 20 | 74 68 65 0d 0a 20 20 20 |lculate |the.. |
|00005eb0| 20 20 61 72 65 61 20 6f | 66 20 72 65 63 74 61 6e | area o|f rectan|
|00005ec0| 67 75 6c 61 72 20 6c 61 | 77 6e 73 20 28 41 3d 4c |gular la|wns (A=L|
|00005ed0| 2a 57 29 2e 20 20 54 68 | 65 20 72 61 74 65 20 66 |*W). Th|e rate f|
|00005ee0| 6f 72 20 61 6e 79 20 6a | 6f 62 20 64 65 70 65 6e |or any j|ob depen|
|00005ef0| 64 73 20 6f 6e 20 74 68 | 65 0d 0a 20 20 20 20 20 |ds on th|e.. |
|00005f00| 73 69 7a 65 20 6f 66 20 | 74 68 65 20 6c 61 77 6e |size of |the lawn|
|00005f10| 2c 20 61 73 20 64 6f 65 | 73 20 74 68 65 20 74 69 |, as doe|s the ti|
|00005f20| 6d 65 2e 20 20 54 68 65 | 73 65 20 61 72 65 20 67 |me. The|se are g|
|00005f30| 69 76 65 6e 20 62 65 6c | 6f 77 3a 0d 0a 0d 0a 0d |iven bel|ow:.....|
|00005f40| 0a 20 20 20 20 20 20 20 | 20 20 1b 2d 01 53 49 5a |. | .-.SIZ|
|00005f50| 45 20 28 53 51 2e 20 46 | 54 1b 2d 00 29 20 20 20 |E (SQ. F|T.-.) |
|00005f60| 20 20 20 1b 2d 01 52 41 | 54 45 2f 53 51 2e 20 46 | .-.RA|TE/SQ. F|
|00005f70| 54 1b 2d 00 2e 20 20 20 | 20 20 20 20 1b 2d 01 48 |T.-.. | .-.H|
|00005f80| 52 53 2f 53 51 2e 46 54 | 0d 0a 0d 0a 1b 2d 00 20 |RS/SQ.FT|.....-. |
|00005f90| 20 20 20 20 20 20 20 20 | 20 20 30 20 2d 20 31 30 | | 0 - 10|
|00005fa0| 30 30 20 20 20 20 20 20 | 20 20 20 20 20 31 2e 35 |00 | 1.5|
|00005fb0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|00005fc0| 20 2e 30 34 0d 0a 20 20 | 20 20 20 20 20 20 20 20 | .04.. | |
|00005fd0| 20 3e 20 31 30 30 30 20 | 20 20 20 20 20 20 20 20 | > 1000 | |
|00005fe0| 20 20 20 20 31 2e 30 30 | 20 20 20 20 20 20 20 20 | 1.00| |
|00005ff0| 20 20 20 20 20 20 20 20 | 2e 30 33 0d 0a 0d 0a 0d | |.03.....|
|00006000| 0a 20 20 20 20 20 54 68 | 65 79 20 6e 65 65 64 20 |. Th|ey need |
|00006010| 61 20 70 72 6f 67 72 61 | 6d 20 74 68 61 74 20 70 |a progra|m that p|
|00006020| 72 6f 64 75 63 65 73 20 | 74 68 65 20 66 6f 6c 6c |roduces |the foll|
|00006030| 6f 77 69 6e 67 20 72 65 | 70 6f 72 74 3a 0d 0a 0d |owing re|port:...|
|00006040| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 1b 2d 01 4e |... | .-.N|
|00006050| 41 4d 45 1b 2d 00 20 20 | 20 20 20 20 20 20 20 20 |AME.-. | |
|00006060| 20 20 20 1b 2d 01 53 49 | 5a 45 20 4f 46 20 4c 41 | .-.SI|ZE OF LA|
|00006070| 57 4e 1b 2d 00 20 20 20 | 20 20 20 20 20 20 20 20 |WN.-. | |
|00006080| 20 1b 2d 01 43 4f 53 54 | 1b 2d 00 20 20 20 20 20 | .-.COST|.-. |
|00006090| 20 20 20 20 20 20 20 1b | 2d 01 54 49 4d 45 0d 0a | .|-.TIME..|
|000060a0| 0d 0a 1b 2d 00 20 20 20 | 20 20 41 4e 44 45 52 53 |...-. | ANDERS|
|000060b0| 4f 4e 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |ON | |
|000060c0| 20 20 31 32 30 20 20 20 | 20 20 20 20 20 20 20 20 | 120 | |
|000060d0| 20 20 20 20 20 20 20 31 | 38 30 20 20 20 20 20 20 | 1|80 |
|000060e0| 20 20 20 20 20 20 20 20 | 34 2e 38 0d 0a 20 20 20 | |4.8.. |
|000060f0| 20 20 2e 2e 2e 2e 2e 2e | 2e 2e 20 20 20 20 20 20 | ......|.. |
|00006100| 20 20 20 20 20 20 20 20 | 20 20 2e 2e 2e 20 20 20 | | ... |
|00006110| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2e | | .|
|00006120| 2e 2e 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00006130| 2e 2e 2e 0d 0a 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |........|... |
|00006140| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 45 20 20 | | .E |
|00006150| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 46 | | .F|
|00006160| 20 20 20 20 20 1b 45 20 | 20 33 34 0d 0a 0d 0a 0c | .E | 34.....|
|00006170| 0d 0a 0d 0a 0d 0a 0d 0a | 1b 46 20 20 20 20 20 1b |........|.F .|
|00006180| 45 43 48 41 50 54 45 52 | 20 33 1b 46 20 20 20 20 |ECHAPTER| 3.F |
|00006190| 20 20 20 20 20 20 20 20 | 20 20 1b 45 20 43 4c 45 | | .E CLE|
|000061a0| 41 4e 49 4e 47 20 55 50 | 20 54 48 45 20 41 43 54 |ANING UP| THE ACT|
|000061b0| 1b 46 20 1b 45 20 20 20 | 1b 46 20 20 20 20 20 20 |.F .E |.F |
|000061c0| 20 20 20 20 20 20 20 20 | 20 20 1b 45 43 48 41 50 | | .ECHAP|
|000061d0| 54 45 52 20 33 0d 0a 0d | 0a 0d 0a 0d 0a 20 20 20 |TER 3...|..... |
|000061e0| 20 20 1b 46 54 4f 54 41 | 4c 20 43 4f 53 54 3a 20 | .FTOTA|L COST: |
|000061f0| 20 20 20 20 20 20 20 20 | 20 20 20 2e 2e 2e 2e 2e | | .....|
|00006200| 2e 0d 0a 20 20 20 20 20 | 54 4f 54 41 4c 20 4e 4f |... |TOTAL NO|
|00006210| 2e 20 4f 46 20 4c 41 57 | 4e 53 3a 20 20 20 20 2e |. OF LAW|NS: .|
|00006220| 2e 2e 2e 2e 2e 0d 0a 20 | 20 20 20 20 54 4f 54 41 |....... | TOTA|
|00006230| 4c 20 53 51 2e 20 46 4f | 4f 54 41 47 45 20 20 20 |L SQ. FO|OTAGE |
|00006240| 20 20 20 2e 2e 2e 2e 2e | 2e 0d 0a 0d 0a 0d 0a 20 | .....|....... |
|00006250| 20 20 20 20 54 68 65 20 | 69 6e 70 75 74 20 64 61 | The |input da|
|00006260| 74 61 20 69 73 20 61 73 | 20 66 6f 6c 6c 6f 77 73 |ta is as| follows|
|00006270| 3a 0d 0a 0d 0a 0d 0a 20 | 20 20 20 20 1b 2d 01 4e |:...... | .-.N|
|00006280| 41 4d 45 1b 2d 00 20 20 | 20 20 20 20 20 20 1b 2d |AME.-. | .-|
|00006290| 01 4c 45 4e 47 54 1b 2d | 00 48 20 20 20 20 20 20 |.LENGT.-|.H |
|000062a0| 20 20 1b 2d 01 57 49 44 | 54 48 0d 0a 0d 0a 1b 2d | .-.WID|TH.....-|
|000062b0| 00 20 20 20 20 20 53 4d | 49 54 48 20 20 20 20 20 |. SM|ITH |
|000062c0| 20 20 20 33 30 20 20 20 | 20 20 20 20 20 20 20 20 | 30 | |
|000062d0| 20 34 30 0d 0a 20 20 20 | 20 20 4a 4f 4e 45 53 20 | 40.. | JONES |
|000062e0| 20 20 20 20 20 20 20 31 | 30 20 20 20 20 20 20 20 | 1|0 |
|000062f0| 20 20 20 20 20 31 30 0d | 0a 20 20 20 20 20 48 45 | 10.|. HE|
|00006300| 52 4d 41 4e 20 20 20 20 | 20 20 20 31 30 20 20 20 |RMAN | 10 |
|00006310| 20 20 20 20 20 20 20 20 | 31 30 30 0d 0a 20 20 20 | |100.. |
|00006320| 20 20 54 48 4f 4d 41 53 | 20 20 20 20 20 20 20 32 | THOMAS| 2|
|00006330| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 33 0d |0 | 3.|
|00006340| 0a 20 20 20 20 20 4f 53 | 43 41 52 53 20 20 20 20 |. OS|CARS |
|00006350| 20 20 20 35 30 20 20 20 | 20 20 20 20 20 20 20 20 | 50 | |
|00006360| 20 31 30 0d 0a 20 20 20 | 20 20 42 45 53 53 49 45 | 10.. | BESSIE|
|00006370| 20 20 20 20 20 20 32 30 | 30 20 20 20 20 20 20 20 | 20|0 |
|00006380| 20 20 20 20 31 30 30 0d | 0a 0d 0a 0d 0a 0d 0a 20 | 100.|....... |
|00006390| 20 20 20 20 57 61 74 63 | 68 20 6f 75 74 20 66 6f | Watc|h out fo|
|000063a0| 72 20 62 75 67 73 20 69 | 6e 20 74 68 65 20 77 65 |r bugs i|n the we|
|000063b0| 65 64 73 20 61 73 20 79 | 6f 75 20 74 69 70 20 74 |eds as y|ou tip t|
|000063c0| 6f 65 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 74 |oe throu|gh the t|
|000063d0| 75 6c 69 70 73 20 61 6e | 64 0d 0a 20 20 20 20 20 |ulips an|d.. |
|000063e0| 6d 6f 77 20 79 6f 75 72 | 20 77 61 79 20 74 68 72 |mow your| way thr|
|000063f0| 6f 75 67 68 20 74 68 65 | 20 63 6f 64 65 2e 20 20 |ough the| code. |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.