#!/usr/athena/bin/perl

use strict;
use warnings;

# Allow using modules in current directory
use FindBin;
use lib "$FindBin::Bin";

use Shape;

my $tri = Triangle->new(3, 4, 5);
$tri->set_color("red");

print "The triangle is a triangle.\n" if $tri->isa("Triangle");
print "The triangle is a square.\n" if $tri->isa("Square");
print "The triangle is a rhombus.\n" if $tri->isa("Rhombus");
print "The triangle is a rectangle.\n" if $tri->isa("Rectangle");
print "The triangle is a parallelogram.\n" if $tri->isa("Parallelogram");
print "The triangle is a quadrilateral.\n" if $tri->isa("Quadrilateral");
print "The triangle is a polygon.\n" if $tri->isa("Polygon");
print "The triangle is a shape.\n" if $tri->isa("Shape");
print "The third side of the triangle is ".$tri->get_C()." units long.\n";
print "The triangle has a perimeter of ".$tri->perimeter()." units.\n";
print "The triangle has an area of ".$tri->area()." square units.\n";
print "The triangle is the color ".$tri->get_color().".\n\n";

my $square = Square->new(2);
$square->set_color("blue");

print "The square is a triangle.\n" if $square->isa("Triangle");
print "The square is a square.\n" if $square->isa("Square");
print "The square is a rhombus.\n" if $square->isa("Rhombus");
print "The square is a rectangle.\n" if $square->isa("Rectangle");
print "The square is a parallelogram.\n" if $square->isa("Parallelogram");
print "The square is a quadrilateral.\n" if $square->isa("Quadrilateral");
print "The square is a polygon.\n" if $square->isa("Polygon");
print "The square is a shape.\n" if $square->isa("Shape");
print "The third side of the square is ".$square->get_C()." units long.\n";
print "The square has a perimeter of ".$square->perimeter()." units.\n";
print "The square has an area of ".$square->area()." square units.\n";
print "The square is the color ".$square->get_color().".\n\n";

my $square2 = $square->new();
$square2->set_color("yellow");

print "The square is a triangle.\n" if $square2->isa("Triangle");
print "The new square is a square.\n" if $square2->isa("Square");
print "The first side of the square is ".$square2->get_A()." units long.\n";
print "The new square is the color ".$square2->get_color().".\n\n";

my $para = Parallelogram->new(2,3);
$para->set_color("green");

print "The parallelogram is a triangle.\n" if $para->isa("Triangle");
print "The parallelogram is a square.\n" if $para->isa("Square");
print "The parallelogram is a rhombus.\n" if $para->isa("Rhombus");
print "The parallelogram is a rectangle.\n" if $para->isa("Rectangle");
print "The parallelogram is a parallelogram.\n" if $para->isa("Parallelogram");
print "The parallelogram is a quadrilateral.\n" if $para->isa("Quadrilateral");
print "The parallelogram is a polygon.\n" if $para->isa("Polygon");
print "The parallelogram is a shape.\n" if $para->isa("Shape");
print "The third side of the parallelogram is ".
    $para->get_C()." units long.\n";
print "The parallelogram has a perimeter of ".$para->perimeter()." units.\n";
#print "The parallelogram has an area of ".$para->area()." square units.\n";
print "The parallelogram is the color ".$para->get_color().".\n";

exit;
