Calculations For Rectangular Containers

"); $leng=$_REQUEST['leng']; $rlengset=$_REQUEST['rlengset']; $wdth=$_REQUEST['wdth']; $rwdthset=$_REQUEST['rwdthset']; $dpth=$_REQUEST['dpth']; $rdpthset=$_REQUEST['rdpthset']; if($leng<=0) { //this line is to prevent a negative input $leng="0"; } echo("Enter Container Length: "); echo("Centimeters..."); } else { echo(">Centimeters..."); } echo("Inches..."); } else { echo(">Inches..."); } echo("".$rlengset."
"); } else { echo(">Feet
"); } echo(NL); if($wdth<=0) { $wdth="0"; } echo("Enter Container Width: "); echo("Centimeters..."); } else { echo(">Centimeters..."); } echo("Inches..."); } else { echo(">Inches..."); } echo("".$rwdthset."
"); } else { echo(">Feet
"); } if($dpth<=0) { $dpth="0"; } echo(NL); echo("Enter Container Depth: "); echo("Centimeters..."); } else { echo(">Centimeters..."); } echo("Inches..."); } else { echo(">Inches..."); } echo("".$rdpthset."
"); } else { echo(">Feet
"); } echo(N2L); echo ("
"); if(!$leng or !$wdth or !$dpth) {} //If no numbers have been entered, don't do anything. elseif(!$rlengset or !$rwdthset or !$rdpthset) { //If no units have been selected echo(" You must select units for each dimension."); }else { If($rlengset=="Centimeters") { $leng=cm2inch($leng); } elseif($rlengset=="Feet") { $leng=ft2inch($leng); } If($rwdthset=="Centimeters") { $wdth=cm2inch($wdth); } elseif($rwdthset=="Feet") { $wdth=ft2inch($wdth); } If($rdpthset=="Centimeters") { $dpth=cm2inch($dpth); } elseif($rdpthset=="Feet") { $dpth=ft2inch($dpth); } $volume=$leng*$wdth*$dpth; $cmvol=$volume*2.54*2.54*2.54; echo("The volume is ".number_format($cmvol,2)." cubic centimeters (cc)(ml).".NL); echo(" . . . . . . . . . . . . ".number_format($cmvol/1000,2)." liters.".NL); echo(" . . . . . . . . . . . . ".number_format($cmvol*1.057/1000,2)." quarts.".NL); echo(" . . . . . . . . . . . . ".number_format($volume,2)." cubic inches.".NL); If($volume/1728 >.099) { echo(" . . . . . . . . . . . . ".number_format(($volume/1728),3)." cubic feet.".NL); } $gal=cuin2gal($volume); if($gal>.099) { echo(". . . . . . . . . . . . ".number_format($gal,3)." gallons.".N2L); } if(($volume*.036111)>.099) { echo("
".NL); echo("This container would hold ".number_format($volume*.036111,3)." pounds of water.".NL); echo("The water pressure at the bottom of this container would be ".number_format($dpth*.036111,3)." psi.
".NL); } } ?>
Calculations Index Circle Calculations Cylinder Calculations Home