{ Assignment 3 }
{ Written by Bryan Bridges }

program assign03;

{ Declare Constants }
const
   Title1 = '                       Pete''s Sweat Shop';
   Title2 = '                         Pay Roll Table';
   Ruler = '--------------------------------------------------------------------';
   Line1 = 'Name           Id         Hours Worked      Pay Rate/Hour      Wage            ';

{ Declare Variables }
var
   name1, name2, name3, name4, name5 : string;
   id1, id2, id3, id4, id5 : integer;
   hours1, hours2, hours3, hours4, hours5 : real;
   rate1, rate2, rate3, rate4, rate5 : real;
   wage1, wage2, wage3, wage4, wage5 : real;
   over1, over2, over3, over4, over5 : real;
   gross1, gross2, gross3, gross4, gross5 : real;
   Input, Output : text;

{ Start Main Program }
begin

{ Assigning Input and Output Files }
   assign (Input, 'D:\FILES\BAB''S\PASCAL\ASSIGN03.INP');
   reset (Input);
   assign (Output, 'D:\FILES\BAB''S\PASCAL\ASSIGN03.OUT');
   rewrite (Output);

{ Read and Close Input File }
   readln (Input, name1);
   readln (Input, id1);
   readln (Input, hours1);
   readln (Input, rate1);
   readln (Input);
   readln (Input, name2);
   readln (Input, id2);
   readln (Input, hours2);
   readln (Input, rate2);
   readln (Input);
   readln (Input, name3);
   readln (Input, id3);
   readln (Input, hours3);
   readln (Input, rate3);
   readln (Input);
   readln (Input, name4);
   readln (Input, id4);
   readln (Input, hours4);
   readln (Input, rate4);
   readln (Input);
   readln (Input, name5);
   readln (Input, id5);
   readln (Input, hours5);
   readln (Input, rate5);
   close (Input);

{ Regular Wage Computing }
  wage1 := hours1 * rate1;
  wage2 := hours2 * rate2;
  wage3 := hours3 * rate3;
  wage4 := hours4 * rate4;
  wage5 := hours5 * rate5;

{ Overtime Wage Computing }
  if hours1 > 40 then
   over1 := (hours1 - 40.00) * (1.50 * rate1);
  if hours2 > 40 then
   over2 := (hours2 - 40.00) * (1.50 * rate2);
  if hours3 > 40 then
   over3 := (hours3 - 40.00) * (1.50 * rate3);
  if hours4 > 40 then
   over4 := (hours4 - 40.00) * (1.50 * rate4);
  if hours5 > 40 then
   over5 := (hours5 - 40.00) * (1.50 * rate5);


{ Add Regular Wages and Overtime }
  gross1 := over1 + wage1;
  gross2 := over2 + wage2;
  gross3 := over3 + wage3;
  gross4 := over4 + wage4;
  gross5 := over5 + wage5;

{ Write and Close Output File }
  writeln (Output, Title1);
  writeln (Output, Title2);
  writeln (Output, Ruler);
  writeln (Output, Line1);
  writeln (Output, Ruler);
  writeln (Output, name1, '       ', id1, '           ', hours1:3:2, '              ', rate1:3:2, '          ', gross1:3:2);
  writeln (Output, name2, '          ', id2, '           ', hours2:3:2, '              ', rate2:3:2, '         ', gross2:3:2);
  writeln (Output, name3, '         ', id3, '           ', hours3:3:2, '              ', rate3:3:2, '         ', gross3:3:2);
  writeln (Output, name4, '         ', id4, '           ', hours4:3:2, '              ', rate4:3:2, '          ', gross4:3:2);
  writeln (Output, name5, '          ', id5, '           ', hours5:3:2, '              ', rate5:3:2, '         ', gross5:3:2);
  writeln (Output, Ruler);
  close (Output);

{ End Main Program }
end.
