General Knowledge Basic General Knowledge Subjective
Mar 19, 2013

Calculate the gross pay for an employee. Input the rate of pay, hours worked and the service record in years. When the service record is greater than 10 years, an allowance of $15 is given. Verify that the program works by supplying appropriate test data.

Detailed Explanation

program PROGFIVE ( input, output );
var grosspay, hoursworked, hourlyrate : real;
    service_record : integer;
begin
    writeln('Please
    enter the hourly pay rate');
    readln( hourlyrate );
    writeln('Please enter the number of hours worked');
    readln( hoursworked );
    grosspay := hoursworked * hourlyrate;
    writeln('Please enter the service record in years');
    readln( service_record );
    if service_record > 10 then grosspay := grosspay + 15;
    writeln('The gross pay is $', grosspay )
end.

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback