Program Lift;
{Written by Philip Smith   January 2007}

Uses Wincrt;

Var
   Person_Wt    :Real;  {Each persons weight, all weights are in kilograms}
   Max_Wt       :Real;  {Maximum weight limit of lift}
   Total_Wt     :Real;  {Total weight of all people in lift}
   Excess       :Real;  {The total wright of people in excess of the Maximum Weight}
   Person_Count :Integer;{The count of people in the lift}

Begin

     {1}Person_Wt       :=0;
     {2}Max_Wt          :=0;
     {3}Total_Wt        :=0;
     {4}Excess          :=0;
     {5}Person_Count    :=0;

     {6}write('Enter maximum weight limit ');
     {7}readln(Max_Wt);

              Begin
                      Repeat
                            {8}write('Enter Person Weight ');
                            {9}readln(Person_Wt);
                            {10}Total_Wt := Total_Wt + Person_Wt ;
                            {11}Person_Count := Person_Count+ 1;
                            {12}writeln('People on board ', Person_Count);
                            {13}writeln('Total weight ', Total_Wt:2:2, 'Kg');
                      until (Total_Wt > Max_Wt);

                      If Total_Wt > Max_Wt
                         Then
                              Begin
                                {14}Excess := Total_Wt - Max_Wt;
                                {15}Writeln('Lift Overloaded');
                              End;
               End;


     {16}Writeln('Program Terminated');
     {17}Writeln('Excess weight ', Excess:2:2, ' Kg');
     {18}Readln;
     {19}
DoneWinCrt;
End.
