                                      (* Chapter 13 - Program 4 *)
program Calculate_Area_Of_Shapes;

uses Areas,Crt,Turbo3;

var In_Char : char;
    Length,Width,Height,Base,Radius : real;

begin  (* main program *)
   repeat
      Writeln;
      Writeln('Please input the first letter of the selection');
      Writeln('Select shape; Square Rectangle Triangle Circle Quit');
      Write('Requested shape is ');
      Repeat until Keypressed;
      Read(Kbd,In_Char);
      case UpCase(In_Char) of
       'S' : begin
             Write('Square   Enter length of side ');
             Readln(Length);
             Writeln('The area is ',Area_Of_Square(Length):12:4);
             end;

       'R' : begin
             Write('Rectangle   Enter width ');
             Readln(Width);
             Write('Enter height ');
             Read(Height);
             Writeln('    The area is ',
                            Area_Of_Rectangle(Width,Height):12:4);
             end;

       'T' : begin
             Write('Triangle     Enter base ');
             Readln(Base);
             Write('Enter height ');
             Read(Height);
             Writeln('    The area is ',
                            Area_Of_Triangle(Base,Height):12:3);
             end;

       'C' : begin
             Write('Circle    Enter radius ');
             Readln(Radius);
             Writeln('The area is ',Area_Of_Circle(Radius):12:3);
             end;

       'Q' : Writeln('Quit');
       else Writeln(' undefined entry');
      end;
   until (In_Char = 'Q') or (In_Char = 'q');
end.  (* of main program *)




{ Result of execution

(The output depends on the data entered at the keyboard)

}
