[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NFC: Fun with Linux - aquavol



#!/usr/bin/perl
#
# Name:    aquavol
# Author:  Chris Hedemark <chris at yonderway_com>
# License: BSD
# Purpose: Determine volume of aquarium based on measurements.

main();

sub main {
aquavol_prep();
aquavol_comp();
aquavol_rpt();
}

sub aquavol_prep {

print "Length (inches): ";
$length = <STDIN>;
chomp $length;

print "Width (inches): ";
$width = <STDIN>;
chomp $width;

print "Depth (inches): ";
$depth = <STDIN>;
chomp $depth;
}

sub aquavol_comp {
$vol = ($length * $width * $depth) / 231;
}

sub aquavol_rpt {
print "Volume: $vol U.S. Gallons\n";
}