	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))
	X=0
	Y=0
	steps = maxTime/dT
	do ct =1,steps
		X = X + (Vx*dT)
		Y = Y + (Vy*dT)
		Fx = -A*(Radius^2)*(Vx^2)
		Fy = -A*(Radius^2)*(Vy^2)
		Vx = Vx + (Fx/Mass)
		Vy = Vy + (Fy/Mass) - (g*dT)
		write (67, '(X,2F7.3)') (X, Y)
	end do
	stop
	
		
