Program TankSize
!-----------------------------------------------------------------------------------------------
!Tyler Martin				Engr 225 Lab 2 Extra Credit		25 January 2012
!					Tank Size Optimization	
!
!Assumptions: That the oil will fill up the tank completely, and that the corners of the tank
!	will be perfectly square and not rounded.
!
!-----------------------------------------------------------------------------------------------

Implicit None
integer, parameter::dp=selected_real_kind(15)
real(dp) :: radius, cylheight, coneheight, totalvol, conevol, cylvol, conearea, cylarea, totalcost, pi

pi = 3.1415959
totalvol = 500.0

write (*,*) "Please enter a radius."
read (*,*) radius

conevol = (pi*radius**3.0)/3.0
coneheight = radius
cylheight = (totalvol - conevol)/(pi*radius**2.0)

write (*,*) "The height of the cone will be ", coneheight
write (*,*) "The height of the cylinder will be ", cylheight

cylarea = 2.0*pi*radius*cylheight + pi*radius**2.0
conearea = pi*radius*sqrt(2.0*radius**2.0)
totalcost = (cylarea*300.0) + (conearea*400.0)

write (*,*) "The total cost of the project in dollars will be ", totalcost

stop
end program tanksize