language: Fortran (gfortran-4.3.4)
date: 112 days 6 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
Tank Size Optimization Extra Credit