You are on page 1of 6

Pseudocode Demo

for Payroll.c

Flowchart,
Hierarchy Chart
and Pseudocode
Flowchart for payroll.c main()
A
Begin
Payroll Employee No Display
# Not 0 Total
?
Wages
Open Yes
Output
File Input Payrate End
& Hours Worked Payroll

Initialize Calculate
Total = 0 Wages

Increment
Clear Screen Total Wages
Get Employee
Number
Output
Employee Data

Input Next
Employee #
A
Flowchart for payroll.c calc_wages()
Begin Pass in
Payrate and
calc_wages Hours

Overtime
Yes ? No

Calc Wages Calc Wages


with without
Overtime Overtime

End
calc_wages
Hierarchy Chart for payroll.c

main( )

calc_wages( )

A hierarchy chart shows what functions other functions call.


Flowchart Symbols

input/output processing start or stop


symbol symbol symbol

module connector
decision symbols
symbol (subroutine or function)
symbol
Pseudocode for Payroll Program
begin main
open output file
initialize total and employee number to 0
clear screen
get employee number
while (employee number not 0)
input payrate and hours worked
<calculate wages>
increment total wages
output employee data
input next employee number
endwhile
display total wages
end main
begin calc_wages(payrate, hours worked)
if (hours worked > 40)
wages = (40 * payrate) + (hours worked - 40) * payrate * overtime multiplier
else
wages = hours worked * payrate
endif
return (wages)
end calc_wages

You might also like