PROGRAMMING SBA
Problem Statement
A program is required that prompts for employee number, job title and
hours worked. It then calculates the regular, overtime pay and total pay
based upon the various pay rates and it prints out employee numbers, job
titles, hours worked, regular pay, overtime pay and total pay.
IPO Chart
INPUT PROCESS OUTPUT
EmployeeNumber Prompt for Employee EmployeeNumber
Number
JobTitle Read JobTitle
EmployeeNumber
HrsWorked Prompt for Job Title HrsWorked
Read JobTitle RegularPay
Prompt for hours OvertimePay
worked
Read HrsWorked TotalPay
Calculate regular pay
Calculate overtime
pay
Calculate total pay
Print
EmployeeNumber,
JobTitle, HrsWorked,
RegularPay,
OvertimePay, TotalPay
Algorithm
ALGORITHM PayrollCalculator
VARIABLES
EmployeeNumber, RateOfPay As Integer
JobTitle As String
HrsWorked, RegularPay, OvertimePay, TotalPay As Real/Float/Double
BEGIN
HrsWorked = 0
RateOfPay = 0
RegularPay = 0
OvertimePay = 0
TotalPay = 0
FOR counter = 1 TO 12 DO
PRINT “Please enter Employee Number”
READ EmployeeNumber
PRINT “Please enter Job Title”
READ JobTitle
PRINT “Please enter hours worked”
Read HrsWorked
IF JobTitle = ‘Manager’ THEN
RateOfPay = 100
ELSE IF JobTitle = ‘Accountant’ THEN
RateOfPay = 80
ELSE IF JobTitle = ‘Sales Representative’ THEN
RateOfPay = 50
ELSE IF JobTitle = ‘Courier Driver’ THEN
RateOfPay = 30
END IF
IF HrsWorked <= 160 THEN
RegularPay = HrsWorked * RateOfPay
ELSE
OvertimePay = (HrsWorked – 160) * RateOfPay * 2
RegularPay = RateOfPay * 160
END IF
TotalPay = RegularPay + OvertimePay
PRINT EmployeeNumber, JobTitle, HrsWorked, RegularPay,
OvertimePay, TotalPay
END FOR
END