0% found this document useful (0 votes)
8 views

Programming SBA Sample v2 - Copy

The document outlines a program for calculating employee pay based on their job title and hours worked. It includes an IPO chart detailing inputs, processes, and outputs, as well as an algorithm for calculating regular, overtime, and total pay. A trace table is provided to illustrate the program's execution with sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Programming SBA Sample v2 - Copy

The document outlines a program for calculating employee pay based on their job title and hours worked. It includes an IPO chart detailing inputs, processes, and outputs, as well as an algorithm for calculating regular, overtime, and total pay. A trace table is provided to illustrate the program's execution with sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

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, counter As Integer
JobTitle As String
HrsWorked, RegularPay, OvertimePay, TotalPay As Real/Float/Double
BEGIN
1 HrsWorked = 0
2 RateOfPay = 0
3 RegularPay = 0
4 OvertimePay = 0
5 TotalPay = 0
6 FOR counter = 1 TO 12 DO
7 PRINT “Please enter Employee Number”
8 READ EmployeeNumber

9 PRINT “Please enter Job Title”

1 READ JobTitle
0 PRINT “Please enter hours worked”
1
1 Read HrsWorked
1
2 IF JobTitle = ‘Manager’ THEN
1
3 RateOfPay = 100
1
4 ELSE IF JobTitle = ‘Accountant’ THEN
1
5 RateOfPay = 80
1
6 ELSE IF JobTitle = ‘Sales Representative’ THEN
1
7 RateOfPay = 50
1
8 ELSE IF JobTitle = ‘Courier Driver’ THEN
1
9 RateOfPay = 30
2
0 END IF

2 IF HrsWorked <= 160 THEN


1 RegularPay = HrsWorked * RateOfPay
2
2 ELSE

2 OvertimePay = (HrsWorked – 160) * RateOfPay * 2


3 RegularPay = RateOfPay * 160
2
4 END IF

2
5
TotalPay = RegularPay + OvertimePay

2 PRINT EmployeeNumber, JobTitle, HrsWorked, RegularPay,


6 OvertimePay, TotalPay
END FOR
END
TRACE TABLE
CODE counter EmployeeNumber JobTitle HrsWorked Rate of RegularPay OvertimePay TotalPay
Line Pay
Number
1 - - - 0 - - - -
2 - - - 0 0 - - -
3 - - - 0 0 0 - -
4 - - - 0 0 0 0 -
5 - - - 0 0 0 0 0
6 1 - - 0 0 0 0 0
8 1 1000 - 0 0 0 0 0
10 1 1000 Manager 0 0 0 0 0
12 1 1000 Manager 140 0 0 0 0
14 1 1000 Manager 140 100 0 0 0
22 1 1000 Manager 140 100 14000 0 0
25 1 1000 Manager 140 100 14000 0 14000

CODE counter EmployeeNumber JobTitle HrsWorked Rate of RegularPay OvertimePay TotalPay


Line Pay
Number
6 2 1000 Manager 140 100 14000 0 14000
8 2 2000 Manager 140 100 14000 0 14000
10 2 2000 Courier 140 100 14000 0 14000
Driver
12 2 2000 Courier 180 100 14000 0 14000
Driver
20 2 2000 Courier 180 30 14000 0 14000
Driver
23 2 2000 Courier 180 30 14000 1200 14000
Driver
24 2 2000 Courier 180 30 4800 1200 14000
Driver
25 2 2000 Courier 180 30 4800 1200 6000
Driver

You might also like