Assignment #4 - 90A
# Assignment #4 - 90A

Assignment 4
============ Due: 14 Feb 90
Weight: 30
An artillery gun position and potential targets are located by
rectangular coordinates. A table of powder charges to be used for
various ranges is given, as are the minimum and maximum azimuths
defining the safety limits for firing the gun at that position.
The maximum range of the gun is also given.
Gun and target coordinates are given as 8-digit integer numbers where
the first 4 digits are the X coordinates to the nearest 10m and the
second 4 digits are the Y coordinates to the nearest 10m. Azimuth
is defined as a clockwise angle measured from the north and can vary
from 0 to 360 degrees.
Write a program to determine and print the range in meters and
azimuth in degrees from the gun position to the target and the
appropriate charge to use. Check the azimuth against the safety
limits and the range against the maximum range. Use a subroutine
to calculate the range and azimuth and a function to determine the
charge.
The coordinates of the gun position are 30005000. The minimum safe
azimuth is 42 degrees, and the maximum safe azimuth is 235 degrees.
The maximum range is 15,000 m. The table of ranges and charges is
Range, m Charge
-------------------------
0-3000 1
3001-6000 2
6001-9000 3
9001-12,000 4
Over 12,000 5
The possible targets are at coordinates:
37415310
32255000
33834032
38733925
30004525
34505515
25354715
38633675
30005000