{************************************************

  Barometric pressure conversion program

 ************************************************}

program KPa_merc;

uses
  Crt;

var
   entry,ans : real;
   entry2 : char;
   Choice : integer;


procedure drawbox;

begin
      Clrscr;
      TextBackground(0);
      TextColor(2);
      GotoXY(19,7);Writeln('浜様様様様様様様様様様様様様様様様様様様様�');
      GotoXY(19,8);Writeln('�                                         �');
      GotoXY(10,9);Writeln('浜様様様擁様様様様様様様様様様様様様様様様様様様様擁様様様様融');
      GotoXY(10,10);Writeln('�                                                            �');
      GotoXY(10,11);Writeln('�                                                            �');
      GotoXY(10,12);Writeln('�                                                            �');
      GotoXY(10,13);Writeln('�                                                            �');
      GotoXY(10,14);Writeln('�                                                            �');
      GotoXY(10,15);Writeln('�                                                            �');
      GotoXY(10,16);Writeln('�                                                            �');
      GotoXY(10,17);Writeln('�                                                            �');
      GotoXY(10,18);Writeln('�                                                            �');
      GotoXY(10,19);Writeln('�                                                            �');
      GotoXY(10,20);Writeln('�                                                            �');
      GotoXY(10,21);Writeln('�                                                            �');
      GotoXY(10,22);Writeln('藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕');
      TextColor(13);
      GotoXY(26,8);Writeln('Barometric Pressure Conversion');
end;

procedure ktom;

begin
   repeat
      drawbox;
      TextBackground(0);
      TextColor(9);
      GotoXY(31,12); Write('Value of KPa ? ');
      Readln(entry);
      ans:= (entry * 0.2953333727);
      GotoXY(28,14);Writeln('Inches of mercury = ',ans:4:1);
      TextBackground(0);
      TextColor(12);
      GotoXY(32,17);Writeln('<R> Run again  ');
      TextBackground(0);
      TextColor(14);
      GotoXY(32,18);Writeln('<Q> Quit ');
      TextBackground(0);
      TextColor(15);
      GotoXY(32,20);Write('Choice ?  ');
      Readln(entry2);
   until UpCase(entry2) = 'Q';
   Clrscr;
end;

procedure mtok;

begin
   repeat
      drawbox;
      TextBackground(0);
      TextColor(11);
      GotoXY(24,12); Write('Value of inches of mercury ? ');
      Readln(entry);
      ans:= (entry * 3.386);
      GotoXY(32,14);Writeln('KPa = ',ans:4:1);
      TextBackground(0);
      TextColor(12);
      GotoXY(32,17);Writeln('<R> Run again  ');
      TextBackground(0);
      TextColor(14);
      GotoXY(32,18);Writeln('<Q> Quit ');
      TextBackground(0);
      TextColor(15);
      GotoXY(32,20);Write('Choice ?  ');
      Readln(entry2);
   until UpCase(entry2) = 'Q';
   Clrscr;
end;


begin
   repeat
      repeat
         drawbox;
         TextBackground(0);
         TextColor(12);
         GotoXY(25,11);Writeln('<1> KPa to inches of mercury');
         TextBackground(0);
         TextColor(3);
         GotoXY(25,13);Writeln('<2> Inches of mercury to KPa');
         TextBackground(0);
         TextColor(14);
         GotoXY(25,15);Writeln('<3> Quit');
         TextBackground(0);
         TextColor(15);
         GotoXY(25,18);Write('Please enter choice: ');
         Readln(Choice);
         CASE Choice OF
            1 : ktom;
            2 : mtok;
         end;
      until ((Choice) = 1) or ((Choice) = 2) or ((Choice) = 3);
   until (Choice) = 3;
   Clrscr;
end.
