P28 Simple Tax Calculator


This is a useful program for keeping an eye on the taxman. It is based on the WHICH? magazine tax calculator for 1980-82, and saves any complicated arithmetic. It cannot be used if you are involved with higher rates of tax, but it could be amended.

The tax rate is used on line 720.

To use the program you require your P60 form and your notice of coding.

Note however that neither the author nor the publisher will accept any responsibility in your negotiations with the taxman.

COMMANDS

Key in program and type RUN.
Follow instructions

  100 REM Program P28 - Simple Tax Calculator
  110 MODE 6
  120 PRINT ''"This program is based on the simple"
  130 PRINT "tax calculator used by WHICH?"
  140 PRINT "The data used is UK tax data for year"
  150 PRINT "1981-1982"
  160 PRINT ''''"PRESS ANY KEY TO CONTINUE"
  170 Z=GET
  180 CLS
  190 PRINT "Page 1"
  200 PRINT "Enter INCOME for period 6 April 1981"
  210 PRINT "to 5 April 1982"
  220 PRINT '"Earnings - enter before-tax earnings of"
  230 PRINT "husband and wife after deducting "
  240 PRINT "contributions to employers' pension"
  250 PRINT "scheme (P60 form). Include as earnings"
  260 PRINT "any expenses you or your wife have to"
  270 PRINT "pay tax on, and the value used for "
  280 PRINT "working out tax on any fringe benefits"
  290 PRINT "you or your wife get  ";
  300 INPUT "`"i_1
  310 PRINT '"Pensions :enter taxable amounts"
  320 PRINT "received  ";
  330 INPUT "`"i_2
  340 PRINT '"Investment Income:"
  350 PRINT "Enter interest not taxed before you get"
  360 PRINT "it. For example, interest from bank"
  370 PRINT "deposit accounts. The interest is "
  380 PRINT "normally taxed on a preceding year"
  390 PRINT "basis - in which case enter income for"
  400 PRINT "period 6/4/80 to 5/4/81  ";
  410 INPUT "`" i_3
  420 A=i_1+i_2+i_3
  430 CLS
  440 PRINT "Page 2"
  450 PRINT "Enter OUTGOINGS and ALLOWANCES for"
  460 PRINT "6/4/81 to 5/4/82"
  470 PRINT '"Expenses in your employment, paid out"
  480 PRINT "of your earnings  ";
  490 INPUT "`" allow_1
  500 PRINT '"Expenses in your wife's employment"
  510 PRINT "paid out of your wife's earnings ";
  520 INPUT "`" allow_2
  530 PRINT '"Interest which qualifies for tax relief"
  540 INPUT "`" allow_3
  550 PRINT '"Personal allowance (`1375 single, "
  560 PRINT "`2145 married) or age allowance"
  570 PRINT "(`1820 single, `2895 married) ";
  580 INPUT"`" allow_4
  590 PRINT '"Wife's earned income allowance (`1375)"
  600 PRINT "or her before-tax earnings less any"
  610 PRINT "allowable expenses in her job, "
  620 PRINT "whichever is less) ";
  630 INPUT"`" allow_5
  640 PRINT'"Other allowances ";
  650 INPUT "`" allow_6
  660 B=allow_1+allow_2+allow_3+allow_4+allow_5+allow_6
  670 CLS
  680 taxable_income=A-B
  690 tax_liable=taxable_income*.3
  700 PRINT "Page 3"''
  710 PRINT "Enter tax already paid:"
  720 PRINT '"Add up tax paid by husband and wife"
  730 PRINT "under PAYE (get from P60), and any "
  740 PRINT "other tax for 1981-82 already paid on"
  750 PRINT "the investment income you've already"
  760 PRINT "entered above ";
  770 INPUT "`" tax_already_paid
  780 PRINT''''''
  790 IF tax_liable>=tax_already_paid THEN PRINT "Tax you ow
e=`";tax_liable-tax_already_paid
  800 IF tax_liable<tax_already_paid THEN PRINT "Tax rebate 
due =`";tax_already_paid-tax_liable
  810 PRINT "(adjust for any tax under- or over-paid"
  820 PRINT "in previous years)"
  830 END

P29 Loan Repayments


I use this program to try to dissuade myself from buying something using a loan from a finance house.

It can be quite illuminating to have a note of the full schedule of repayments for a loan and how slowly the amount owed drops.

If the interest rate changes during the period of a loan then simply run the program again as if you had taken out a new loan, with a reduced amount borrowed.

COMMANDS

Key in program and type RUN.
Follow instructions.


100 REM Program P29 - Loan Repayments 110 MODE 4 120 PRINT ''"This program can be used to plan" 130 PRINT "the repayments schedule for a loan." 140 PRINT "The loan is paid back at a fixed " 150 PRINT "monthly rate. The interest is also" 160 PRINT "fixed. The program produces the " 170 PRINT "repayments table." 180 INPUT '"Enter amont of loan "amount 190 INPUT '"Enter monthly repayments "repayment 200 INPUT '"Enter monthy interest rate(%) "interest 210 INPUT '"Month number (1-12) "month 220 INPUT '"Year "year 230 PRINT '"The program produces a listing of the" 240 PRINT "report one page at a time. To see" 250 PRINT "subsequent pages press the shift key"'' 260 PRINT "Press any key to continue": z=GET 270 CLS 280 PRINT "Year","Month","Amount","Amount" 290 PRINT " "," ","paid","owed" 300 VDU 28,0,31,39,4:VDU 14 310 paid=0 320 REPEAT 330 month=month+1 340 IF month=13 THEN year=year+1:month=1 350 amont=amount+amount*interest/100 360 amount=amount+amount*interest/100 370 paid=paid+repayment 380 @%=4 390 PRINT year,SPC(4)month;" "; 400 @%=&20208 410 PRINT paid,amount 420 UNTIL amount<0 430 VDU 15


P30 Monthly Accounts


In our household, one task that has to be done is the monthly budget.

The program prompts the user to enter all of his outgoings and income, and ends up with a printout onto paper of screen of a monthly balance sheet.

The program is self explanatory.

COMMAND

Key in program and type RUN.
If you are using a printer ensure that correct *FX commands have been used.

  100 REM Program P30 - Monthly Accounts
  110 @%=&2020A
  120 MODE 6
  130 PRINT TAB(5,12)"M O N T H L Y   A C C O U N T S"
  140 Z=INKEY(300)
  150 CLS
  160 PRINT "This program helps you to budget"
  170 PRINT "your monthly outgoings and incomings."
  180 PRINT "The program prompts you to enter your "
  190 PRINT "financial dealings and produces a "
  200 PRINT "balance sheet for the next month."
  210 PRINT ''"Press any key to continue"
  220 Z=GET
  230 CLS
  240 PRINT TAB(1,1)"Regular outgoings-";
  250 INPUT TAB(1,3)"Mortgage repayment " mort
  260 INPUT TAB(1,4)"Rates payment " rates
  270 INPUT TAB(1,5)"Rent payment " rent
  280 INPUT TAB(1,6)"Electricity " electric
  290 INPUT TAB(1,7)"Gas " gas
  300 credit=0:L=9
  310 REPEAT
  320   INPUT TAB(1,L)"Credit repayments (0 to finish) " c
  330   credit=credit+c
  340   L=L+1
  350 UNTIL c=0
  360 PRINT TAB(1,L+3);"Any other regular payments,"
  370 PRINT TAB(1,L+4);"enter total m";
  380 INPUT others
  390 regular=mort+rates+rent+electric+gas+credit+others
  400 CLS
  410 PRINT TAB(1,1)"Other outgoings this month"
  420 INPUT TAB(1,4)"Outstanding bills (total) "oldbills
  430 INPUT TAB(1,6)"Grocery bill "grocer
  440 INPUT TAB(1,7)"Butchers bill "butcher
  450 INPUT TAB(1,8)"Entertainment allowance "ents
  460 b=0:L=13
  470 PRINT TAB(1,12);"Other bills due this month"
  480 REPEAT
  490   INPUT TAB(1,L)"Amount (0 to finish) " b
  500   bills=bills+b
  510   L=L+1
  520 UNTIL b=0
  530 bills_this_month=bills+grocer+butcher+ents
  540 total_out=regular+bills_this_month+oldbills
  550 CLS
  560 PRINT TAB(1,1)"Monthly income"
  570 PRINT TAB(1,3)"Your net income ";
  580 INPUT boss
  590 PRINT TAB(1,4)"Your wife's net income ";
  600 INPUT wife
  610 PRINT TAB(1,8)"Any other net income ";
  620 INPUT more_money
  630 income=boss+wife+more_money
  640 balance=income-total_out
  650 debit=FALSE
  660 IF balance<0 THEN debit=TRUE
  670 CLS
  680 PRINT "          MONTHLY BUDGET"
  690 PRINT '" COMMENT" TAB(22);"-OUT-";TAB(33);"-IN-"
  700 PRINT TAB(23); "-`-"; TAB(34); "-`-"
  710 PRINT '''"Regular amounts" TAB(FNP(20,regular));regula
r
  720 PRINT '"Bills this month" TAB(FNP(20,bills_this_month)
);bills_this_month
  730 PRINT '"Outstanding bills"
  740 PRINT "from last month";TAB(FNF(20,oldbills));oldbills
  750 PRINT '"TOTAL OUTGOINGS";TAB(FNP(20,total_out));total_
out
  760 PRINT ''"TOTAL INCOME";TAB(FNP(30,income));income
  770 IF debit THEN position=20 ELSE position=30
  780 IF debit THEN d$="DEBIT" ELSE d$="CREDIT"
  790 PRINT ''d$;" BALANCE";TAB(FNP(position,balance));balan
ce
  800 @%=10
  810 END
  820  
  830 DEF FNP(column,const)
  840 s=column+10-LEN(STR$(const))
  850 IF const=INT(const) THEN s=s-3
  860 =s

P31 Conversion


This is a general purpose conversion utility, which I have implemented with seventeen different conversion factors. It is fairly straightforward to choose different units to be converted by changing the data statements at the end of the program.

Seventeen conversions were chosen to make the main menu fit the screen.

Once the conversion has been chosen, the user has to decide which way the conversion has to proceed, for example, centimetres to inches or inches to centimetres.

COMMANDS

Key in program and type RUN.
Select from menu.

  100 REM Program P31 - Conversion
  110 MODE 6
  120 REPEAT
  130   CLS
  140   PRINT "Conversion utility" ''
  150   RESTORE
  160   @%=2
  170   FOR I=1 TO 17
  180     READ a$,b$
  190     PRINT I;SPC(3);a$;" to ";b$
  200   NEXT I
  210   @%=10
  220   PRINT
  230   INPUT "Choose Option "choice
  240   CLS
  250   RESTORE 570
  260   FOR I=1 TO choice
  270     READ a$,b$
  280   NEXT I
  290   RESTORE 660
  300   FOR I=1 TO choice
  310     READ factor
  320   NEXT I
  330   PRINT ''"1."a$" to "b$
  340   PRINT ''"2."b$" to "a$
  350   INPUT '"Choose Option "choice
  360   IF choice=2 THEN PROCb_to_a ELSE PROCa_to_b
  370   INPUT ''"Another run? (Y/N) "res$
  380 UNTIL res$<>"Y"
  390 END
  400  
  410 DEF PROCa_to_b
  420 PRINT ''"Enter "a$;
  430 INPUT a
  440 b=a*factor
  450 PRINT ''STR$(a);SPC(3);a$ " = " STR$(b);SPC(3);b$
  460 ENDPROC
  470  
  480 DEF PROCb_to_a
  490 PRINT ''"Enter "b$;
  500 INPUT b
  510 a=b/factor
  520 PRINT ''STR$(b);SPC(3);b$ " = " STR$(a);SPC(3);a$
  530 ENDPROC
  540  
  550 REM Conversions
  560 REM These can be changed
  570 DATA Inches,Centimetres,Feet,Metres,Yards,Metres
  580 DATA Miles,Kilometres,Teaspoons,Cubic centimetres
  590 DATA Tablespoons,Cubic cenitmetres,Cups,Litres
  600 DATA Pints,Litres,Quarts,Litres,Gallons,Litres
  610 DATA Ounces,Grams,Pounds,Kilograms,Tons,Kilograms
  620 DATA Miles/hour,Metres/sec,Square yards,Square metres
  630 DATA Years,seconds,Atmospheres,cm Hg
  640 REM Conversion data
  650 REM corresponds to above
  660 DATA 2.540,0.3048,0.9144,1.609,4.929,14.788,0.2366
  670 DATA 0.4732,0.9463,4.546,28.3495,0.4536,907.2,0.447
  680 DATA .8361,31536000,76


P32 Birthday Lists


This program uses one of the SORT routines developed later on in the book, the so-called Bubble Sort.

If you wish to see this routine operating try program P36.

The Birthday List program is used to store all those birthdays you have to remember. The program sorts the birthdays into date order, and then prints all birthdays left in the current year. All birthdays are stored in DATA statements in lines 1000 to 2000. Notice that the birthdays are terminated with EOF - end of file.

COMMANDS

Key in program, add birthdays as DATA statements then type RUN.
Follow instructions.

  100 REM Program P32 - Birthday Lists
  110 MODE 6
  120 @%=2
  130 PRINT "The birthdays held in this program"
  140 PRINT "are held in data statements starting at"
  150 PRINT "line 1000. The final data statement is"
  160 PRINT "line 2000. If you wish to change"
  170 PRINT "the list enter the data in the format"
  180 PRINT ''"1100 DATA name,mmdd"'' "where dd is day,mm is
 month"
  190 PRINT ''"Press any key"
  200 Z=GET
  210 CLS:I=0
  220 DIM name$(100),dates(100)
  230 REPEAT
  240   I=I+1
  250   READ name$(I),dates(I)
  260 UNTIL name$(I)="EOF"
  270 I=I-1
  280 PROCsort
  290 INPUT "What is today's date (mmdd)"date
  300 PRINT '"The birthdays left this year are"'''
  310 FOR J=1 TO I
  320   IF dates(J)>date THEN PRINT name$(J);"'s birthday is
 ";:PROCdate
  330 NEXT J
  340 END
  350  
  360 DEF PROCsort
  370 FOR X=1 TO I-1
  380   FOR Y=X+1 TO I
  390     IF dates(Y)<dates(X) THEN PROCswap
  400   NEXT Y
  410 NEXT X
  420 ENDPROC
  430  
  440 DEF PROCswap
  450 t=dates(Y):t$=name$(Y)
  460 dates(Y)=dates(X):name$(Y)=name$(X)
  470 dates(X)=t:name$(X)=t$
  480 ENDPROC
  490  
  500 DEF PROCdate
  510 day=dates(J) MOD 100
  520 month=dates(J) DIV 100
  530 RESTORE 2000
  540 FOR Z=1 TO month
  550   READ m$
  560 NEXT Z
  570 PRINT day", "m$
  580 ENDPROC
  590  
 1000 DATA Jim Smith,1130
 1010 DATA Bill Smythe,0812
 1020 DATA Liz Graham,303
 1030 DATA John Gordon,419
 1040 DATA John Ferguson,407
 1050 DATA Teresa Gordon,1222
 1060 DATA EOF,0
 1070  
 2000 DATA January,February,March,April,May,June,July,August
,September,October,November,December,eod


P33 Diary


This is one of my favourite programs. It is used to store a diary in the computer system.

The soft keys are programmed as follows:

Key 0 holds the commandsAUTO1,1 <cr>
DATA

and when pressed, the automatic line number utility is called in starting at line 1 and incrementing by one. Line number 1 is given the BASIC keyword DATA. Note <cr> is carriage return.

Key 1 holds the commands<cr>
DATA

and when pressed, a new BASIC program line number is generated with the BASIC keyword DATA being the first word on the line.

Key 10 - the break key, has been programmed to OLD the program memory and restart the diary program running. The program gives the user opportunity to list the diary page on the screen.

The diary data is thus stored in the form of DATA statements. Once the diary page has been written it can be SAVEd to tape or disc as required.

COMMANDS

Key in program and type RUN.
Follow instructions as presented.
To save diary page use the following procedure;

SAVE "data"

Where "date" is the data of the diary page.


10000 REM Program P33 - Diary 10010 DATA "That's all" 10020 *KEY0"AUTO 1,1|MDATA" 10030 *KEY 1"|MDATA" 10040 *KEY 10"OLD|MRUN|M" 10050 MODE 6 10060 PRINT "Press KEY0 then after each line press" 10070 PRINT "KEY1. Press BREAK to finish" 10080 VDU 28,0,24,39,4 10090 PRINT "To list diary press P" 10100 Y$=INKEY$(300) 10110 IF Y$<>"P" THEN CLS:END 10120 REPEAT 10130 READ L$ 10140 PRINT L$ 10150 UNTIL L$="That's all" 10160 END


P34 Calendar


This program can be used to print out the calendar for any month in the twentieth century.

Note that month must be in the correct format eg. March, April. If you wish to make the program more insensitive to data input then see the routines in P35.

COMMANDS

Key in program and type RUN.
Enter month when requested.

  100 REM Program P34 - Calendar
  110 DIM day_name$(7),calendar$(7,6)
  120 FOR I=1 TO 7:READ day_name$(I):NEXT I
  130 MODE 6
  140 PRINT TAB(12,12) "C A L E N D A R"
  150 Z=INKEY(300)
  160 CLS
  170 INPUT''"Which month do you require (eg January)" ' mon
th$
  180 REPEAT
  190   READ m$,first_of_the_month,days_in_month
  200   month=month+1
  210 UNTIL month$=m$
  220 INPUT ''"Which year do you require "year
  230 IF year>1900 THEN year=year-1900
  240 no_of_leap_years=year DIV 4
  250 this_is_leap_year=FALSE
  260 IF year MOD 4=0 THEN this_is_leap_year=TRUE
  270 offset=year+no_of_leap_years
  280 IF this_is_leap_year AND month<3 THEN offset=offset-1
  290 IF this_is_leap_year AND month=2 THEN days_in_month=29
  300 offset=offset MOD 7
  310 first_of_the_month=(first_of_the_month + offset) MOD 7
  320 IF first_of_the_month=0 THEN first_of_the_month=7
  330 FOR I=1 TO first_of_the_month - 1
  340   calendar$(I,1)=" "
  350 NEXT I
  360 day=1
  370 FOR I=first_of_the_month TO 7
  380   calendar$(I,1)=STR$(day)
  390   day=day+1
  400 NEXT I
  410  
  420 FOR J=2 TO 6
  430   FOR I=1 TO 7
  440     calendar$(I,J)=STR$(day)
  450     day=day+1
  460     IF day>days_in_month THEN I=7:J=6
  470   NEXT I
  480 NEXT J
  490 CLS
  500 PRINT TAB(10,3);month$,year+1900
  510 FOR I=1 TO 7
  520   PRINT TAB(5,I+10);day_name$(I);
  530 NEXT I
  540 FOR J=1 TO 6
  550   FOR I=1 TO 7
  560     PRINT TAB(J*3+10,I+10);calendar$(I,J);
  570   NEXT I
  580 NEXT J
  590 PRINT
  600 END
  610  
  620 DATA Mon,Tue,Wed,Thu,Fri,Sat,Sun
  630 DATA January,1,31,Februar,4,28,March,4,31,April,7,30
  640 DATA May,2,31,June,5,30,July,7,31,August,3,31,Septembe
r,6,30
  650 DATA October,1,31,November,4,30,December,6,31



P35 Telephone List


This program allows the user to select a telephone number from a list held as DATA statements.

You do not have to enter the full name to select the number. As long as the string entered is part of one of the names, then the telephone number is displayed.

Note the use of FNcase which turns lower case characters into upper case. This routine could be used to improve some of the other programs. The data names used within the routine are all LOCAL.

COMMANDS

Key in program.
Enter telephone list as DATA statements before line 340.
Type RUN.
Enter name when requested.


100 REM Program P35 - Telephone List 110 MODE 6 120 PRINT TAB(10,4) "Telephone Directory" 130 REPEAT 140 RESTORE 150 count=0 160 PRINT ''"Whose number do you want"; 170 REPEAT 180 INPUT name$ 190 UNTIL name$<>"" 200 CLS 210 name$=FNcase(name$) 220 REPEAT 230 READ entry$,number$ 240 IF INSTR(entry$,name$)>0 THEN PRINT entry$ "'s num ber is "number$:count=count+1 250 UNTIL entry$="EOF" 260 IF count=0 THEN PRINT "We have no number correspondi ng to "name$ 270 INPUT ''"Another number",answer$ 280 a$=LEFT$(answer$,1) 290 UNTIL a$="n" OR a$="N" 300 END 310 320 DEF FNcase(a$) 330 LOCAL d$,I,c$,c 340 d$="" 350 FOR I=1 TO LEN(a$) 360 c$=MID$(a$,I,1) 370 c=ASC(c$) 380 IF c>96 AND c<122 THEN c$=CHR$(c-32) 390 d$=d$+c$ 400 NEXT I 410 =d$ 420 430 REM Place your telephone numbers on the following line s 440 DATA BILL SMITH,12345,BILL JONES,45678,ALICE GRAHAM,01 -234 6542 450 DATA FRANCIS CAMPBELL,5687 67,JOHN GORDON,6754-98 460 DATA EOF,EOF


P36 Investments


This program calculates how much income can be generated from capital if the interest earned by that capital is known.

The user is presented with the choice of increasing his or her income at the expense of reducing capital. Not having any capital, I have not yet had recourse to using the program, but it's nice to dream!

COMMANDS

Key in program and type RUN.

  100 REM Program P36 - Investments
  110 MODE 6
  120 @%=&2020A
  130 PRINT "This program allows the user to plan"
  140 PRINT "his future investments, given that he"
  150 PRINT "wishes his investment to give him a"
  160 PRINT "regular income"
  170 INPUT ''"Income required (monthly) `"income
  180 INPUT "Interest rate (% per annum) "interest
  190 interest=interest/100
  200 REM assume that investment interest is compounded mont
hly
  210 investment=income*12/interest
  220 PRINT ''"An investment of "'"`";investment'"will provi
de a monthly income of"'"`"; income
  230 PRINT '"Note that no capital is used."'
  240 PRINT "If you wish to use up your capital how"
  250 PRINT "many years do you require an income for"
  260 INPUT years
  270 interest=interest/12
  280 temp=(1+interest)^(12*years)
  290 investment=income*(temp-1)/interest/temp
  300 PRINT ''"An investment of `";investment'"will provide 
a monthly income of"'"`";income '"for "STR$(years)" years"
  310 END

RUN This program allows the user to plan his future investments, given that he wishes his investment to give him a regular income Income required (monthly) £100 Interest rate (% per annum) 10 An investment of £12000.00 will provide a monthly income of £100.00 Note that no capital is used. If you wish to use up your capital how many years do you require an income for ?5 An investment of £4706.54 will provide a monthly income of £100.00 for 5 years