program PayDay;
{William Sanchez
Lab Assignment #2
Payroll calculation program
July 30, 1990
Pascal Senior}

var
 employee : string[7];   {define variables}
 Hours,
 payrate,
 grosspay : real;
 ch : char;

Begin
 clrscr;     {clear the screen}
 Writeln;
 Writeln('                         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
 Writeln('                         $            PAYDAY!           $');
 writeln('                         $  Payroll Calculation Program $');
 writeln('                         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
 writeln;
 ch := 'y';          {define ch as 'y'}
 while ch='y' do     {set condition for loop}
  begin
   hours := 0;
   payrate := 0;      {initialize values as zero}
   grosspay :=0;
   Writeln;
   Write ('Enter 7-Digit Alpha-Numerical Employee Code: ');
   readln(employee);
   Write ('Enter Number of Hours Worked: ');     {request input}
   readln(hours);
   Write ('Enter Employee Payrate: ');
   readln(payrate);
   If hours <=40 Then
    begin                                    {calculation for pay for 40}
     Grosspay := hours * payrate;             {hours or less}
    end
   Else                                      {calcuations for 40+ hours}
    begin
     Grosspay := (hours - 40) * (1.5 * payrate) + (40 * payrate);
    end;
   Writeln ('Employee ',employee, ' has made: $',grosspay:9:2); {output gross pay...format to 9 digits+2decimal}
   write (Chr(7));               {beep}
   Writeln;
    repeat
     write('Calculate another salary? (y/n)');
     readLN (ch);                               {request input for loop}
    Until ch IN ['y', 'n'];
   writeln;
  end;
 clrscr; {clear the screen}
 writeln;
 writeln;
 writeln('Thank You for using...');
 delay(1000);     {pause for 1 second}
 Writeln;
 writeln;
 writeln;
 writeln;
 writeln;
 writeln ('                           $$$$$$$$$$$$$$$$$');
 writeln ('                           $    PAYDAY!    $');
 writeln ('                           $$$$$$$$$$$$$$$$$');
End.
