home *** CD-ROM | disk | FTP | other *** search
- \ Comp 462
- \ Balraj Sidhu Set: 14D4
- \ Date: March 29, 1990
- \ Problem 2.14 -- Table of surface area and volume of a tank (part a)
-
- : tank_area ( l w h -- )
- 3dup 5 roll * 2 * -rot * 2 * + -rot * 2 * + ;
-
- : .one ( n -- )
- 9 spaces \ Indent table entry
- dup 8 .r \ print number
- dup dup dup tank_area 12 .r \ print area of tank
- dup dup * * 13 .r ; \ print volume of tank
-
- : .heading ( -- -- )
- cr cr
- cr 14 spaces ." SIDE SURFACE AREA VOLUME "
- cr 14 spaces ." feet Square feet cubic feet "
- cr 14 spaces ." ==== ============ ========== " ;
-
- : .cubical_table ( first last --- )
- .heading
- 1+ swap
- ?do cr i .one loop
- cr cr ;
-
- \ Proble 2.14 -- Part b
- \ Spherical tank
-
- : *pi ( n -- n*pi )
- 355 113 */ ;
-
- : sptank_volume ( l w h -- )
- 4 *pi * * * 3 / ;
-
- : sptank_area
- * 4 * *pi ;
-
- : .print ( n -- )
- 9 spaces \ Indent table entry
- dup 8 .r \ print number
- dup dup sptank_area 12 .r \ print area of tank
- dup dup sptank_volume 13 .r ; \ print volume of tank
-
- : .heading2 ( -- -- )
- cr cr
- cr 14 spaces ." RADIUS SURFACE AREA VOLUME "
- cr 14 spaces ." ====== ============ ========== " ;
-
- : .spherical_table ( first last --- )
- .heading2
- 1+ swap
- ?do cr i .print loop
- cr cr ;
-
-
-