All pastes #775666 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-15 18:08 UTC
rendered paste body
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  hoursW : real;

function pay(hours:real) : real;
begin
  if (hours < 41) then pay := hours * 12.50
  else
    begin
      pay := (40 * 12.50) + ((hours - 40) * 17.00);
    end;
end;

function nat(pay:real) : real;
begin
  if (pay > 670) then
    begin
      nat := ((670 - 87) / 100 * 11) + ((pay - 670) / 100 * 1);
    end
  else
    begin
      nat := (pay - 87) / 100 * 11
    end;
end;

procedure your_mum;
begin
  write('Enter hours worked: ');
  readln(hoursW);
  if (hoursW > 60) OR (hoursW < 0) then
    begin
      writeln('Invalid working hour - must be within range 0 - 60');
      your_mum;
    end
  else
    begin
      writeln('The gross pay is ',pay(hoursW):1:2);
      writeln('National Insurance deduction: ',nat(pay(hoursW)):1:2);
      writeln;
    end;   
end;

begin
  repeat            
    your_mum;
  until hoursW = 0;
end.