pseudocode demo for payroll.c flowchart, hierarchy chart and pseudocode

6
Pseudocode Demo Pseudocode Demo for Payroll.c for Payroll.c Flowchart, Flowchart, Hierarchy Chart Hierarchy Chart and Pseudocode and Pseudocode

Upload: candice-stanley

Post on 30-Dec-2015

284 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

Pseudocode DemoPseudocode Demofor Payroll.cfor Payroll.c

Flowchart, Flowchart, Hierarchy ChartHierarchy Chartand Pseudocodeand Pseudocode

Page 2: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

Flowchart for payroll.c main()Begin

Payroll

OpenOutput

File

InitializeTotal = 0

Clear ScreenGet Employee

Number

A

A

Employee# Not 0

?

Input Payrate& Hours Worked

CalculateWages

IncrementTotal Wages

Output Employee Data

Input NextEmployee #

DisplayTotal

Wages

EndPayroll

Yes

No

Page 3: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

Flowchart for payroll.c calc_wages()

Begincalc_wages

Overtime?

Calc Wageswith

Overtime

Endcalc_wages

Calc Wageswithout

Overtime

Yes No

Pass inPayrate andHours

Page 4: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

Hierarchy Chart for payroll.c

main( )

calc_wages( )

A hierarchy chart shows what functions other functions call.

Page 5: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

Flowchart Symbols

input/outputsymbol

processingsymbol

start or stopsymbol

decisionsymbol

module(subroutine or function)

symbol

connectorsymbols

Page 6: Pseudocode Demo for Payroll.c Flowchart, Hierarchy Chart and Pseudocode

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