	program Exercise2
	parameter (pi = 3.14159, g = 9.8)
C	This program is a drag
C	More specifically, it is about drag.  It is doing a numerical
C	integration of a spherical projectile, accounting for drag...
	real A, Vinit, Angle, Radius, Mass, dT, Vx, Vy, X, Y
	real Fx, Fy, Density
	integer steps, ct
	open (66, file='drag.inp',status='old')
	open (67, file='drag.dat',status='unknown')
	read (66, *) A
	read (66, *) Vinit
	read (66, *) Angle
	read (66, *) Radius
	read (66, *) Mass
	read (66, *) dT
	read (66, *) maxTime 
C	Variables should be in the following form:
C		A	drag coefficient kg/m^3
C		Vinit	Initial velocity in meters per second
C		Angle	Angle, in radians, from horizontal
C		Radius	Radius of projectile in metres
C		Mass	Mass of projectile, in kg
C		dT	time increment, in seconds
C		maxTime	time to calculate position until, in seconds

	Density = (Mass)/(4000/3)*(pi)*(Radius**3)
C	write (*,*) ('Density of projectile ',Density)
	Vx = Vinit*(cos(Angle))
	Vy = Vinit*(sin(Angle))
        write (67,9) Vx, Vy, 0
	X=0
	Y=0
	steps = maxTime/dT
	do 10 ct = 1, steps
		X = X + (Vx*dT)
		Y = Y + (Vy*dT)
		Fx = (-1)*A*(Radius**2)*(Vx**2)*(Vx/(ABS(Vx)))
		Fy = (-1)*A*(Radius**2)*(Vy**2)*(Vy/(ABS(Vy)))
		Vx = Vx + (dT*Fx/Mass)
		Vy = Vy + (dT*Fy/Mass) - (g*dT)
		write (67, 9) X, Y, ct*dT, Vx, Vy
 9              format (' ',5(F7.3," "))
10     continue
       end

	
		
