EasyManua.ls Logo

Tandy TRS-80 - Page 78

Tandy TRS-80
104 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
APPENDIX
C.
SAMPLE
PROGRAMS
SAMPLE PROGRAM
#1
BALANCING YOUR CHECKBOOK
This program creates
a
master disk file
which contains
all your checks and deposits for the entire
year. You can
print them
out by
the month
or the year. If
you want to
use
your printer, change
the appropriate PRINT lines
to PRINT
#-2.
(See Chapter 21 in
Getting Started
with
Color BASIC).
10
'
Checkbook
Program
20
'
30
'
This program
provides
a
r e
c o r
d
o f y o u r
c h
e
c k s ?
40
'
deposits?
and balances.
The checks
can be labeled
50
'
with an account number
to
show to what expense
60
'
they were
paid* such as
medical
?
rent ? food?
etc
.
70
'
The
program uses
direct
addressing?
each file
record
80
'
being
40 bytes long?
and
formatted as
follows! 8
90
'
bytes
for the
date? 4 bytes
for
the
check or deposit
100
'
slip
number? 20
bytes for
the
recipient
of the check
110
7
3 bytes
for the
account
number?
and 5 bytes for
the
120
'
amount of
the check or
deposi t
.
130
'
140 CLEAR
1000
150 DIM CHK*<50)
160
CLS
170 PRINT
3
107?
"SELECTIONS:"
180 PRINT a
162?
"1) ADD
CHECKS
TO YOUR
FILE"
190 PRINT
a
194?
"2)
LIST YOUR
CHECKS?
DEPOSITS?
"
200 PRINT
a
229?
"AND
BALANCES"
230 PRINT 3
322?
"3) END JOB?"
240 PRINT
a 394?
"(1?2?
OR
3>"
250
AN*= INKEY*
260 IF AN*=""
THEN
250
270 ON VAL(AN*)
GOSUB
310? 700?
1080? 1560
280 GOTO
160
290
'
300
'
3 1
'
This
s u b r o u
t i n e
inputs
the data.
320
'
330 OPEN
"D"
?
#1
?
" CHECKS/DAT"
? 40
340 FIELD
#1?8 AS DATE*?
4 AS CHNO*?
20 AS
PDTO*? 3 AS ACNO*?
5 AS AMT*
350 REC
=
L0F<1)
360
REC
=
REC
+
1
370 CLS
380 PRINT a 64?
"CHECK OR
DEPOSIT
(C/D)"
390 AN*
=
INKEY*
400 IF AN*
=
"D" THEN 430
410 IF
AN*
=
"C" THEN
490
420
GOTO 390
430 INPUT
"DEPOSIT DATE
(MM/DD/YY)";D*
440
INPUT
"DEPOSIT
SLIP
NUMBER
< NNNN
)
" ; C*
450
P*
=
"
"
460 INPUT
"ACCOUNT NUMBER*
NNN) "? A*
470
INPUT "AMOUNT
OF DEPOSIT" 5 AMT
480 GOTO
550
490 INPUT
"CHECK
DATE
(MM/DD/YY)
"
;D*
500 INPUT
"CHECK NUMBER
< NNNN
>"?
C*
510
INPUT
"PAID
TO"
? P*
520 INPUT
"ACCOUNT
NUMBER
< NNN)
" ; A*
530 INPUT
"AMOUNT
OF CHECK";
AMT
540 AMT
=
-AMT
550 LSET DATE*
=
D*
560 LSET CHNO*
=
C*
570 LSET PDTO*
=
P*
580 LSET ACNO*
=
A*
590 LSET AMT*
=
MKN* ( AMT
)
600 PUT #1?REC
61.0 PRINT 3 320?
"MORE
INPUT(Y/N)"
620 AN*
=
INKEY*
630 IF AN*
=
"N" THEN 660
640
IF
AN*
=
"Y"
THEN 360
650 GOTO
620
660 CLOSE
#1
670 RETURN
680
'
690
'
700
'
This subroutine
balances
the
checkbook
and outputs the
results.
710
'
720 OPEN
"
D"
?
#1
?
" CHECKS/DAT"
? 40
730 FIELD #1,8
AS DATE*? 4
AS CHNO*?
20
AS PDTO*?
3 AS ACNO*?
5 AS AMT*
740 CLS
750 PRINT 3
160?
"DO YOU WANT A
LISTING FOR A MONTH OR FOR
THE"
760 PRINT
3
192?
"WHOLE YEAR? (Y/M)"
770 INPUT
A*
780 IF
A*
=
"M" THEN
PRINT 3 254?
68

Related product manuals