0200                   BAC-220 STANDARD VERSION   2/1/62

0200      COMMENT SECOND EXAMPLE PROGRAM FROM BALGOL MANUAL, MARCH 1963.

0200      THIS IS THE CORREECTED VERSION THAT COMPUTES AREA USING NORTH/SOUTH

0200      RATHER THAN NORTH/SOUTH DISPLACEMENTS IN THE CALCULATION FOR -SUM-.

0200

0200      THE PROGRAM WHICH FOLLOWS IS ONE FOR SURVEY TRAVERSE CALCULATIONS$

0200

0200      COMMENT SURVEY TRAVERSE CALCULATIONS$

0200      TRACE ANGLE$

0200      DUMP EW, NS, CD$

0400      INTEGER I, J, K, SURVEY, D(), M(), S(), Q(), N$

0400      FUNCTION LENGTH(X,Y) = SQRT(X*2 + Y*2)$

0413      ARRAY D(200), M(200), S(200), Q(200), MD(200), NS(200),

0413            EW(200), CNS(201), CEW(201)$

0413

0413      START..

0415        READ($$ IDENT)$

0419        TMD = 0$ TNS = 0$ TEW = 0$

0422        FOR I= (1,1,N)$

0433          BEGIN

0434          READ ($$ STATION)$

0438          IF I NEQ K$

0438            STOP K$

0438

0444          Z = (60(60D(I) + M(I)) + S(I))/6.48**5$

0457          SWITCH Q(I), (QUAD1, QUAD2, QUAD3, QUAD4)$

0464          QUAD1.. Z = 0.5 - Z$ GO TO ANGLE$

0470          QUAD2.. Z = 1.5 + Z$ GO TO ANGLE$

0476          QUAD3.. Z = 0.5 + Z$ GO TO ANGLE$

0482          QUAD4.. Z = 1.5 - Z$

0487      ANGLE..

0487          ALPHA = 3.1415927Z$

0494          NS(I) = MD(I)SIN(ALPHA)$

0500          TNS = TNS + NS(I)$

0504          EW(I) = MD(I)COS(ALPHA)$

0510          TEW = TEW + EW(I)$

0514          TMD = TMD + MD(I)

0518          END$

0518

0519        ERROR = LENGTH(TNS, TEW)$

0526        WRITE ($$ TITLE, F1)$

0534        NSCF = -TNS/TMD$

0538        EWCF = -TEW/TMD$

0542        TCD = 0$ TCNS = 0$ TCEW = 0$

0545        FOR I = (1,1,N)$

0556          BEGIN

0556          CNS(I) = NS(I) + MD(I).NSCF$

0562          TCNS = TCNS + CNS(I)$

0566          CEW(I) = EW(I) + MD(I).EWCF$

0571          TCEW = TCEW + CEW(I)$

0575          CD = LENGTH(CNS(I), CEW(I))$

0584          TCD = TCD + CD$

0587          WRITE ($$ ANSWERS, F2)

0591          END$

0591

0596        CNS(N+1) = CNS(1)$

0599        CEW(N+1) = CEW(1)$

0602        SUM = 0$

0603        NSLOC = 0$ EWLOC = 0$

0605        FOR I=(1,1,N)$

0616          BEGIN

0616          NSLOC = NSLOC + CNS(I)$

0621          EWLOC = EWLOC + CEW(I)$

0625          SUM = SUM + (CNS(I+1)) (CEW(I+1) + 2EWLOC)

0629          END$

0629

0633        SQFT = ABS(SUM)/2$

0637        ACRES = SQFT/43560$

0641        WRITE ($$ TOTALS, F3)$

0649        GO TO START$

0649

0650      INPUT

0655        IDENT (SURVEY, N),

0660        STATION (K, D(I), M(K), S(I), Q(I), MD(I))$

0687      OUTPUT

0692        TITLE (SURVEY, N, ERROR),

0700        ANSWERS (I, D(I), M(I), S(I), Q(I), MD(I), CD, CNS(I), CEW(I)),

0738        TOTALS (TMD, TCD, TCNS, TCEW, SQFT, ACRES)$

0760      FORMAT

0760        F1 (*SURVEY*, I8, B5, *NUMBER OF LEGS*, I5, B5, *CLOSURE ERROR*,

0760            X9.2, W1,

0760            *LEG*, B5, *ANGLE*, B7, *MEASURED*, B5, *CORRECTED*, B3,

0760            *NORTH-SOUTH    EAST-WEST*, W6,

0760            *NO.   DD MM SS Q     DISTANCE      DISTANCE  DISPLACEMENT *,

0760            *DISPLACEMENT*,2W),

0760        F2 (I3, I5, 2I3, I2, 4X13.2, W),

0760        F3 (B6, *TOTALS*, B4, 4X13.2, W4, *AREA OF TRAVERSE*, X13.2,

0760            * SQUARE FEET*, X13.2, * ACRES*, W6)$

0835      FINISH$
COMPILED PROGRAM ENDS AT 0836
PROGRAM VARIABLES BEGIN AT 2511

SURVEY    1234     NUMBER OF LEGS    7     CLOSURE ERROR     7.33






LEG     ANGLE       MEASURED     CORRECTED   NORTH-SOUTH    EAST-WEST

NO.   DD MM SS Q     DISTANCE      DISTANCE  DISPLACEMENT DISPLACEMENT

  1   62 30  0 2       137.00       136.85       -62.23       121.88
  2   29 30  0 2        83.80        83.36       -72.30        41.48
  3   73 30  0 2       124.40       124.45       -34.40       119.60
  4   39 30  0 1       149.80       150.91       116.70        95.68
  5   39 30  0 3       111.70       112.15        87.02       -70.75
  6   88 30  0 4       266.50       265.75        -4.98      -265.70
  7   54 30  0 4        52.00        51.66       -29.80       -42.19

      TOTALS           925.20       925.16         -.00         -.00

AREA OF TRAVERSE     45199.14 SQUARE FEET         1.03 ACRES

